首页 > Web开发 > 详细

php结合linux 执行通道关闭重启

时间:2014-06-21 07:14:48      阅读:389      评论:0      收藏:0      [点我收藏+]

<?php
if( $_SERVER[‘REMOTE_ADDR‘]!=‘‘ ) DIE;
$curFile = __FILE__;
$ROOT = dirname($curFile);
include $ROOT."/config.cron.php";
$caefile=CACHE."/channel.cae.php";

$exp = explode(‘case/‘,$curFile);
$runFile = $exp[1];

exec("ps xau | grep cron_send | grep -v grep | awk ‘{print $12\"__\"$2}‘",$row);
foreach($row as $file)
{
    $file = trim($file);
    list($file,$kid) = explode(‘__‘,$file);
    if($file)
    {
        $exp = explode(‘case/‘,$file);
        $files[$exp[1]]=$kid;
    }
}

$cjfile = $ROOT.‘/jc.php‘;
echo $cjfile.‘=======‘;
$cFiles = file($cjfile);
unlink($cjfile);
foreach( $cFiles as $kf )
{
    $kf = trim($kf);
    list($f,$s) = explode(‘__‘,$kf);
    $exp = explode(‘case/‘,$f);
    if( $s==‘1‘ && $f )//重启
    {
        
        echo $exec = "nohup /usr/local/php5/bin/php {$f} > /opt/null &";
        system($exec);
    }
    else if( $s==‘0‘ )    //关闭
    {
           $kid = $files[$exp[1]];
            echo $exec = "kill $kid";
            exec($exec);
    }
}

if( $files[$runFile]>1 )
{
    die(‘已经运行中,当前无法启动....‘);
}
?>

php结合linux 执行通道关闭重启,布布扣,bubuko.com

php结合linux 执行通道关闭重启

原文:http://www.cnblogs.com/cwl168/p/3795372.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!