Set the command to systemctl to manage boot from start

  1. Add systemd configuration file:
vim /usr/lib/systemd/system/程序名.service

The contents of the file are as follows:

[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
  1. Set boot up
systemctl daemon-reload     # 重新加载配置服务 

systemctl enable 程序名 # 程序名为设置server文件的名字 
  1. starting program
systemctl start 程序

Guess you like

Origin blog.csdn.net/qq_26129413/article/details/112919390