cpanel后启动会导致nginx终止?

cpanel后启动会导致nginx终止?

情况不明

现在将 nginx的自启动次序放到cpanel, 貌似开机能正常启动了。。。。。汗

 

发现还是没用啊

只好用以下脚本,假如cron每分钟运行一次

root@front [/]# cat /sbin/nginx-on.php
#!/usr/bin/php -q
<?php

$res = shell_exec('ps aux | grep "nginx: worker process"');
if (strpos($res, "nginx: worker process") !== false) {}
else {
    shell_exec("/etc/init.d/nginx restart");
}



//new version 2015/5/20
#!/usr/bin/php -q
<?php

$res = shell_exec('ps aux | grep "nginx: worker process"');
if (preg_match("/^nginx.+nginx: worker process/Ui",$res)) 
{ echo "Nginx is running...\r\n"; }
else {
    echo "Nginx is NOT running...trying to restart...\r\n";
    shell_exec("/etc/init.d/nginx restart");
}

发表评论 0

Your email address will not be published. Required fields are marked *