进入/lib/systemd/system/目录
cd /lib/systemd/system/
建立zentao.service
touch zentao.service
vim zentao.service
输入:
[Unit]
Description=zentao zbox
After=network.target
[Service]
Type=forking
ExecStart=/opt/zbox/zbox start
ExecReload=/opt/zbox/zbox restart
ExecStop=/opt/zbox/zbox stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
修改权限:
chmod 754 zentao.service
查看服务状态
systemctl status zentao.service
启用服务:
systemctl enable zentao.service
重启服务器:
shutdown -r now