Sample Header Ad - 728x90

Error: could not open `user_jvm_args.txt`

0 votes
1 answer
4272 views
This is my first time making a bash script into a service and I'm running into an error where the service fails because it can't open a text file that is used for java arguments (user_jvm_args.txt). I assume there's some sort of permissions issue going on, but I'm at a loss. Anything helps as I'm trying to get better and learn. Thanks! Here's the service file:
[Service]
ExecStart=/home/ethan/ATM9-Server/run.sh
Here's the run.sh bash script:
#!/usr/bin/env sh

java @user_jvm_args.txt @libraries/net/minecraftforge/forge/1.20.1-47.1.3/unix_args.txt "$@"
Here's the user_jvm_args.txt file that is in the same folder as the run.sh script:
# Xmx and Xms set the maximum and minimum RAM usage, respectively.
# They can take any number, followed by an M or a G.
# M means Megabyte, G means Gigabyte.
# For example, to set the maximum to 3GB: -Xmx3G
# To set the minimum to 2.5GB: -Xms2500M
# A good default for a modded server is 4GB.

-Xms1G
-Xmx10G
-XX:+UseG1GC
-XX:+ParallelRefProcEnabled
-XX:MaxGCPauseMillis=200
-XX:+UnlockExperimentalVMOptions
-XX:+DisableExplicitGC
-XX:+AlwaysPreTouch
-XX:G1NewSizePercent=30
-XX:G1MaxNewSizePercent=40
-XX:G1HeapRegionSize=8M
-XX:G1ReservePercent=20
-XX:G1HeapWastePercent=5
-XX:G1MixedGCCountTarget=4
-XX:InitiatingHeapOccupancyPercent=15
-XX:G1MixedGCLiveThresholdPercent=90
-XX:G1RSetUpdatingPauseTimePercent=5
-XX:SurvivorRatio=32
-XX:+PerfDisableSharedMem
-XX:MaxTenuringThreshold=1
Most of those are defaults, and the only ones I changed were -Xms and -Xmx. Here's the that error occurs as it shows in the logs:
Nov 03 15:44:43 ATM9-Server-Temp systemd: Started run.service.
Nov 03 15:44:43 ATM9-Server-Temp run.sh: Error: could not open `user_jvm_args.txt'
Nov 03 15:44:43 ATM9-Server-Temp systemd: run.service: Main process exited, code=exited, status=1/FAILURE
Nov 03 15:44:43 ATM9-Server-Temp systemd: run.service: Failed with result 'exit-code'.
Asked by EChumley1310 (1 rep)
Nov 3, 2023, 09:04 PM
Last activity: Jun 30, 2025, 10:04 AM