エラー: 'user_jvm_args.txt'を開けません。

エラー: 'user_jvm_args.txt'を開けません。

bashスクリプトをサービスにしたのは今回が初めてで、Java引数のテキストファイル(user_jvm_args.txt)を開くことができなかったため、サービスが失敗したというエラーが発生しました。ある種の権限問題があると思いますが、迷っています。より良くなって学びようと努力すれば何でも役に立ちます。ありがとうございます!

サービスファイルは次のとおりです。

[Service]
ExecStart=/home/ethan/ATM9-Server/run.sh

run.sh bashスクリプトは次のとおりです。

#!/usr/bin/env sh

java @user_jvm_args.txt @libraries/net/minecraftforge/forge/1.20.1-47.1.3/unix_args.txt "$@"

以下は、run.shスクリプトと同じフォルダーにあるuser_jvm_args.txtファイルです。

# 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

ほとんどはデフォルトで、私が変更したのは-Xmsと-Xmxだけです。

ログに示すように発生したエラーは次のとおりです。

Nov 03 15:44:43 ATM9-Server-Temp systemd[1]: Started run.service.
Nov 03 15:44:43 ATM9-Server-Temp run.sh[12480]: Error: could not open `user_jvm_args.txt'
Nov 03 15:44:43 ATM9-Server-Temp systemd[1]: run.service: Main process exited, code=exited, status=1/FAILURE
Nov 03 15:44:43 ATM9-Server-Temp systemd[1]: run.service: Failed with result 'exit-code'.

ベストアンサー1

ユーザー、グループ、および作業ディレクトリを追加すると、問題なく起動できることがわかりました。

おすすめ記事