已解決,分享給大家
https://my.oschina.net/owenzhang24/blog/5534156
有興趣看看,提下建議,謝謝
/usr/lib/systemd/system/webman.service
[Unit]
Description=Webman sevice
After=network.target network-online.target nss-lookup.target
[Service]
Restart=on-failure
User=www-data
Type=forking
PIDFile=/path/to/webman/runtime/webman.pid
SyslogLevel=err
ExecStart=/usr/bin/php /path/to/webman/start.php start -d
ExecReload=/usr/bin/php /path/to/webman/start.php reload -d
KillMode=mixed
[Install]
WantedBy=multi-user.target
我推薦PM2,root安裝后,其他用戶可以直接使用
systemctl/supervisor這種操作需要sudo權(quán)限,實(shí)際上服務(wù)器一般帳號(hào)是不給sudo權(quán)限的