首页
下载
文档
社区
视频
捐赠
源代码
赞助商
AOT 编译器
AI 助理
商业产品
PHP AOT 原生编译器
Swoole-Compiler 代码加密器
CRMEB 新零售社交电商系统
登录
注册
全部
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
发表新帖
systemd无法启动swoole服务
### 问题描述 我在centos中使用使用systemd方式管理swoole服务,编写的脚本如下 ``` [Unit] Description=Unipay Sandbox Server 聚合支付沙箱环境 After=network.target After=syslog.target [Service] Type=simple LimitNOFILE=65535 ExecStart=/usr/local/bin/php /zsmart/wwwroot/ZsmartPay/Index.php ExecReload=/bin/kill -USR1 $MAINPID Restart=always [Install] WantedBy=multi-user.target graphical.target ``` 在开发中可以正常启动swoole服务 但是当我设置swoole以守护进程方式启动,将swoole的`daemonize =1`时,使用`systemctl start xx.sercice`启动服务失败了,请问下这是什么原因。 ```php ● unipay.service - Unipay Sandbox Server 聚合支付沙箱环境 Loaded: loaded (/etc/systemd/system/unipay.service; disabled; vendor preset: disabled) Active: failed (Result: start-limit) since 二 2020-04-07 10:56:24 CST; 2min 15s ago Process: 11742 ExecStart=/usr/local/bin/php /zsmart/wwwroot/ZsmartPay/Index.php (code=exited, status=0/SUCCESS) Main PID: 11742 (code=exited, status=0/SUCCESS) 4月 07 10:56:24 zsmart002 systemd[1]: unipay.service holdoff time over, scheduling restart. 4月 07 10:56:24 zsmart002 systemd[1]: Stopped Unipay Sandbox Server 聚合支付沙箱环境. 4月 07 10:56:24 zsmart002 systemd[1]: start request repeated too quickly for unipay.service 4月 07 10:56:24 zsmart002 systemd[1]: Failed to start Unipay Sandbox Server 聚合支付沙箱环境. 4月 07 10:56:24 zsmart002 systemd[1]: Unit unipay.service entered failed state. 4月 07 10:56:24 zsmart002 systemd[1]: unipay.service failed. ```
发布于6年前 · 2 次浏览 · 来自
提问
xmsite
### 问题描述 我在centos中使用使用systemd方式管理swoole服务,编写的脚本如下 ``` [Unit] Description=Unipay Sandbox Server 聚合支付沙箱环境 After=network.target After=syslog.target [Service] Type=simple LimitNOFILE=65535 ExecStart=/usr/local/bin/php /zsmart/wwwroot/ZsmartPay/Index.php ExecReload=/bin/kill -USR1 $MAINPID Restart=always [Install] WantedBy=multi-user.target graphical.target ``` 在开发中可以正常启动swoole服务 但是当我设置swoole以守护进程方式启动,将swoole的`daemonize =1`时,使用`systemctl start xx.sercice`启动服务失败了,请问下这是什么原因。 ```php ● unipay.service - Unipay Sandbox Server 聚合支付沙箱环境 Loaded: loaded (/etc/systemd/system/unipay.service; disabled; vendor preset: disabled) Active: failed (Result: start-limit) since 二 2020-04-07 10:56:24 CST; 2min 15s ago Process: 11742 ExecStart=/usr/local/bin/php /zsmart/wwwroot/ZsmartPay/Index.php (code=exited, status=0/SUCCESS) Main PID: 11742 (code=exited, status=0/SUCCESS) 4月 07 10:56:24 zsmart002 systemd[1]: unipay.service holdoff time over, scheduling restart. 4月 07 10:56:24 zsmart002 systemd[1]: Stopped Unipay Sandbox Server 聚合支付沙箱环境. 4月 07 10:56:24 zsmart002 systemd[1]: start request repeated too quickly for unipay.service 4月 07 10:56:24 zsmart002 systemd[1]: Failed to start Unipay Sandbox Server 聚合支付沙箱环境. 4月 07 10:56:24 zsmart002 systemd[1]: Unit unipay.service entered failed state. 4月 07 10:56:24 zsmart002 systemd[1]: unipay.service failed. ```
赞
0
收藏
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
登录
后参与评论
评论
2020-04-08
1
15754******
Type=simple 应该不能和 daemonize =1一起使用,请查阅systemd文档选择正确姿势
赞
1
回复
2020-04-08
李铭昕
systemd 我很久没用了。。 不过如果是使用 Docker ,启动的时候是不能设置后台运行的,因为 Docker 只会按照你当前的 pid 来判断服务是否启动。而后台启动,你会发现启动之后 pid 是改变的。 我想 systemd 应该也是同理吧。。。
赞
1
回复