CentOS 7カスタム起動サービス
0、起動するスクリプト権限を設定します(voteに実行可能権限がない場合、サービスが正常に起動できません.特に重要度を0ステップで識別します)
1、カスタムサービスを編集し、サービス名はvote.service
vote.サービスの内容は以下の通りです.
2、vote.サービスファイルの後、次のコマンドを実行して有効にする必要があります.
3、vote.サービス起動
4、サービス操作コマンド集錦
5、CenOS 7以降のオペレーティングシステムは以下のコマンドでサービスを起動、停止することができる.
chmod +x vote
1、カスタムサービスを編集し、サービス名はvote.service
vim /usr/lib/systemd/system/vote.service
vote.サービスの内容は以下の通りです.
[Unit]
Description=vote
After=rc-local.service
[Service]
Type=forking #
ExecStart=/springcloud/vote start #
ExecReload=/springcloud/vote restart #
ExecStop=/springcloud/vote stop #
PrivateTmp=true # ( )
[Install]
WantedBy=multi-user.target
2、vote.サービスファイルの後、次のコマンドを実行して有効にする必要があります.
systemctl daemon-reload
3、vote.サービス起動
systemctl enable vote.service
4、サービス操作コマンド集錦
:systemctl enable vote.service
:systemctl disable vote.service
:systemctl start vote.service
:systemctl stop vote.service
:systemctl restart vote.service
:systemctl status vote.service
:systemctl is-enabled vote.service
:systemctl list-unit-files|grep enabled
5、CenOS 7以降のオペレーティングシステムは以下のコマンドでサービスを起動、停止することができる.
service vote start
service vote stop
service vote restart