Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/236.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
监视php进程的shell脚本_Php_Shell_Process - Fatal编程技术网

监视php进程的shell脚本

监视php进程的shell脚本,php,shell,process,Php,Shell,Process,如何在进程死机时自动重新启动它 我现在是这样做的: #!/bin/bash while true;do ps -aux 2>/dev/null |grep redis_subscribe|grep -v grep >/dev/null if [ $? -ne 0 ];then php /data/www/wwwroot/app.eclicks.cn/oil/index.php public/redis_subscribe subscribe 2&g

如何在进程死机时自动重新启动它

我现在是这样做的:

#!/bin/bash
while true;do
    ps -aux 2>/dev/null |grep redis_subscribe|grep -v grep >/dev/null
    if [ $? -ne 0 ];then
        php /data/www/wwwroot/app.eclicks.cn/oil/index.php public/redis_subscribe subscribe   2>&1 >>/data/cilogs/manitor/image_upload.log &
    fi;
    sleep 10;
done;
2> /dev/null将“警告:语法错误,可能是假的”重定向到/dev/null

并且,>/dev/null是相同的。
希望能帮助你

你说死人是什么意思?现在还不太清楚你在这里是什么意思。试着对你想要什么、你的代码应该做什么以及为什么它没有用给出更多的解释。
#!/bin/bash
while true;do
    ps -aux 2>/dev/null |grep redis_subscribe|grep -v grep >/dev/null
    if [ $? -ne 0 ];then
        php /data/www/wwwroot/app.eclicks.cn/oil/index.php public/redis_subscribe subscribe   2>&1 >>/data/cilogs/manitor/image_upload.log &
    fi;
    sleep 10;
done;