systemd:
CentOS 7的服务systemctl脚本存放在:/usr/lib/systemd/
,有系统(system)和用户(user)之分;
即:/usr/lib/systemd/system
和/usr/lib/systemd/user
创建文件eport.service
保存在/usr/lib/systemd/system
,内容如下:
[Unit]
Description=eport
After=network.target
[Service]
Type=forking
PIDFile=/home/david/SocketServer/runtime/SocketServer.pid
ExecStart=/usr/bin/php /home/david/SocketServer/start.php start -d
ExecReload=/usr/bin/php /home/david/SocketServer/start.php restart -d
ExecStop=/usr/bin/php /home/david/SocketServer/start.php stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
相关命令
安装服务:sudo systemctl enable eport.service
禁止服务:sudo systemctl disable eport.service
启动服务:sudo systemctl start eport.service
停止服务:sudo systemctl stop eport.service
重启服务:sudo systemctl restart eport.service
重载服务:sudo systemctl reload eport.service
查看日志:sudo journalctl -f -u eport.service
版权属于:大卫科技Blog
本文链接:https://www.iyuu.cn/archives/477/
转载时须注明出处