php重启nginx脚本

来源:岁月联盟 编辑:exp 时间:2011-09-14

重启nginx是执行 /usr/bin/nginxd restart 即可
以下是脚本内容:
#!/usr/local/php/bin/php
<?
if($argv[1]=="start")
{
echo system("ulimit -SHn 51200");
echo system("/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf");
}
elseif($argv[1]=="stop")
{
echo system("killall -9 nginx");
}
elseif($argv[1]=="test")
{
echo system("/usr/local/nginx/sbin/nginx -t");
}
elseif($argv[1]=="restart")
{
echo system("killall -9 nginx");
sleep(1);
echo system("ulimit -SHn 51200");
echo system("/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf");
}
else
        echo "Usage: nginx {start|stop|restart|test|}/r/n";
?>

作者“稀饭吃了不顶饿”