一:编写程序启动命令脚本
vim /root/start.sh
二:编写启动脚本
cd /etc/systemd/system
vim start.service
[Unit]
Description=Start My Server
After=network.target
[Service]
Type=forking
ExecStart=/root/start start
TimeoutSec=0
RemainafterExit=yes
GuessMainPID=no
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable start.service