# systemctl配置自启service
# 推荐安装目录
/usr/lib/systemd/system/
# 演示案列
[Unit]
Description=app Service
Documentation=websocket://127.0.0.1:7205
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=root
WorkingDirectory=/usr/local/workman/
ExecStart=/usr/bin/php start.php start
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=always
StandOutput=syslog
StandError=inherit
[Install]
WantedBy=multi-user.target
# 开机启动
# 加载
systemctl daemon-reload
# 激活开机自启
systemctl enable app.service
# 运行
systemctl start app.service
← linux