问题是这样的:为了保证websocket的服务正常,我在crontab里加了个定时监听的功能,检测服务是否开启若服务没有启动就restart,然而出现的情况是,服务没有启动,crontab也检测到了也执行了重启命令但是就是重启失败,查看日志也没有报异常。请问这是什么原因呢???
这是检测代码和重启代码
tcp_status=$(ps -aux | grep /opt/var/www/html/rj/3rdparty/GatewayWorker/start.php | grep -v grep)
if
then
php /opt/var/www/html/rj/3rdparty/GatewayWorker/start.php restart -d
fi
日志
cron:
Sep 13 19:17:01 localhost CROND: (root) CMD (/usr/bin/php -f /opt/var/www/html/rj/apps/files/publishhomework.php &>/dev/null 2>&1)
Sep 13 19:17:01 localhost CROND: (root) CMD (/usr/bin/sh /opt/var/www/html/rj/checkRedisAndTcp.sh &>/dev/null 2>&1)
Sep 13 19:18:01 localhost CROND: (root) CMD (/usr/bin/php -f /opt/var/www/html/rj/apps/files/publishhomework.php &>/dev/null 2>&1)
Sep 13 19:18:01 localhost CROND: (root) CMD (/usr/bin/sh /opt/var/www/html/rj/checkRedisAndTcp.sh &>/dev/null 2>&1)
Sep 13 19:19:01 localhost CROND: (root) CMD (/usr/bin/php -f /opt/var/www/html/rj/apps/files/publishhomework.php &>/dev/null 2>&1)
Sep 13 19:19:01 localhost CROND: (root) CMD (/usr/bin/sh /opt/var/www/html/rj/checkRedisAndTcp.sh &>/dev/null 2>&1)
workerman:
2017-09-13 19:17:01 pid:6849 Workerman restart
2017-09-13 19:17:01 pid:6849 Workerman is stoping ...
2017-09-13 19:17:06 pid:6849 Workerman stop fail
2017-09-13 19:18:01 pid:6869 Workerman restart
2017-09-13 19:18:01 pid:6869 Workerman is stoping ...
2017-09-13 19:18:06 pid:6869 Workerman stop fail
2017-09-13 19:19:01 pid:6887 Workerman restart
2017-09-13 19:19:01 pid:6887 Workerman is stoping ...
2017-09-13 19:19:06 pid:6887 Workerman stop fail
http://doc.workerman.net/315235
手册里列举了几种可能性
哥 你解决了吗 我也一样的问题