linux 进程守护
linux创建service文件
/usr/lib/systemd/system/*.service
文件内容为
[Unit]
Description=xxx
After=network.target
[Service]
Type=simple
WorkingDirectory=path_xxx
ExecStart=path_xxx/xxx
Restart=on-failure
[Install]
WantedBy=multi-user.target
执行 systemctl daemon-reload
重载配置
启动: systemctl start xxx
关闭: systemctl stop xxx
配置开机自启: systemctl enable xxx
取消开机自启: systemctl disable xxx
状态: systemctl status xxx
重启: systemctl restart xxx