一、在/etc/init.d下创建webman_app文件,权限777,文件内容如下
#!/bin/sh ### BEGIN INIT INFO # Provides: webman_app # Required-Start: $remote_fs $network # Required-Stop: $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the Webman App Service # Description: starts the Webman App Service ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON="/usr/bin/php /source/html/webman/start.php " case "$1" in start) $DAEMON start -d ;; stop) $DAEMON stop ;; status) $DAEMON status ;; reload) $DAEMON reload ;; *) echo "Usage: $NAME {start|stop|reload|status}" >&2 exit 3 ;; esac
二、在/etc/systemd/system下创建webman_app.service文件,权限777,内容如下
[Unit] Description=Webman App Server After=network.target Wants=network.target [Service] Restart=on-failure RestartSec=5 ExecStart=/etc/init.d/webman_app start PIDFile=/source/html/webman/runtime/webman.pid [Install] WantedBy=multi-user.target
三、配置开机自启动
# 使配置生效 systemctl daemon-reload # 设置开机自启动 systemctl enable webman_app.service
备注:请确保各文件中配置的地址正常
标签:bin,service,start,Webman,app,webman,usr,自启动 From: https://www.cnblogs.com/liyong2019/p/18597661