zoukankan      html  css  js  c++  java
  • php结合linux 执行通道关闭重启

    <?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('已经运行中,当前无法启动....');
    }
    ?>

  • 相关阅读:
    input上传图片的坑
    nodejs创建一个静态文件服务器的根目录anywhere
    深浅拷贝
    es6中数组的flat()和flatMap()
    new Date()在ios上的坑
    一些常用的css Hack
    IntrospectorCleanupListener
    http header
    ActionContextCleanUp
    OpenSessionInViewFilter
  • 原文地址:https://www.cnblogs.com/cwl168/p/3795372.html
Copyright © 2011-2022 走看看