serviceファイル 作成
/etc/systemd/system/password-generator.service
[Unit] Description=password-generator After=syslog.target [Service] User=kenji ExecStart=/home/kenji/password-generator.jar SuccessExitStatus=143 [Install] WantedBy=multi-user.target
confファイル 作成
password-generator.conf
export LANG="ja_JP.UTF8" JAVA_OPTS="-Xms1024M -Xmx1024M" RUN_ARGS="--spring.profiles.active=production"
サービスとして登録・起動
サービスリロード
systemctl daemon-reload
サービス有効化、無効化
systemctl enable password-generator.service systemctl disable password-generator.service
サービス起動、再起動、止める、確認
systemctl start password-generator.service systemctl restart password-generator.service systemctl stop password-generator.service systemctl status password-generator.service