workerman怎么设置开机重启自启动(linux环境)

本篇文章给大家介绍一下linux系统下workerman设置开机重启自启动的方法。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。

workerman怎么设置开机重启自启动(linux环境)

相关推荐:《workerman

第一步:创建workerman.service服务文件(权限755)

/lib/systemd/system/workerman.service

workerman怎么设置开机重启自启动(linux环境)

第二步:复制以下代码保存退出,注意修改你的workerman路径

workerman怎么设置开机重启自启动(linux环境)

路径:/www/wwwroot/xxx.com/server.php

启动命令:php server.php start

上面命令中能启动,路径就是下面这样子

[Unit] Description=workerman After=network.target  [Service] Type=forking ExecStart=/usr/bin/php /xxx/xxx/server.php start -d ExecReload=/usr/bin/php /xxx/xxx/server.php restart ExecStop=/usr/bin/php /xxx/xxx/server.php stop PrivateTmp=true RemainAfterExit=yes  [Install] WantedBy=multi-user.target

workerman怎么设置开机重启自启动(linux环境)

修改这个文件,一定重启服务器,不然不生效的

第三步:启动服务

systemctl start workerman.service

第四步:查看服务状态

systemctl status workerman.service

第五步:开机启动

systemctl enable workerman.service

workerman怎么设置开机重启自启动(linux环境)

注意:

宝塔这里不作用,上面生成后会在这里也生成一个任务,不要操作

workerman怎么设置开机重启自启动(linux环境)

 错误:

The unit file, source configuration file or drop-ins of workerman.service changed on disk. Run ‘systemctl daemon-reload’ to reload units

workerman怎么设置开机重启自启动(linux环境)

修改了workerman.service服务文件没有重启服务器

更多编程相关知识,请访问:workerman!!

以上就是

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享