- systemd構成ファイルを追加します。
vim /usr/lib/systemd/system/程序名.service
ファイルの内容は次のとおりです。
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
ExecStart=这里写绝对路径程序的启动命令,例如 /usr/local/程序 -c /usr/local/程序配置文件
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true
StandardOutput=syslog
StandardError=inherit
[Install]
WantedBy=multi-user.target
- 起動を設定する
systemctl daemon-reload # 重新加载配置服务
systemctl enable 程序名 # 程序名为设置server文件的名字
- 開始プログラム
systemctl start 程序