現在、ほとんどのディストリビューションで実行されるSystemd
ステップ1:
鉱山があったユーザー定義サービスを見つけます/usr/lib/systemd/system/
ステップ2:
お気に入りのテキスト エディタで名前を付けてテキスト ファイルを作成します。whatever_you_want.service
ステップ 3:
次の
テンプレートをファイルに入れますwhatever_you_want.service
[Unit]
Description=webserver Daemon
[Service]
ExecStart=/usr/bin/java -jar /web/server.jar
User=user
[Install]
WantedBy=multi-user.target
ステップ 4:
サービス
をスーパー ユーザーとして実行する
$ systemctl start whatever_you_want.service # starts the service
$ systemctl enable whatever_you_want.service # auto starts the service
$ systemctl disable whatever_you_want.service # stops autostart
$ systemctl stop whatever_you_want.service # stops the service
$ systemctl restart whatever_you_want.service # restarts the service