当前位置: 首页>>代码示例>>PHP>>正文


PHP unix::PROCESS_TTL方法代码示例

本文整理汇总了PHP中unix::PROCESS_TTL方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::PROCESS_TTL方法的具体用法?PHP unix::PROCESS_TTL怎么用?PHP unix::PROCESS_TTL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unix的用法示例。


在下文中一共展示了unix::PROCESS_TTL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: user_status_table

function user_status_table()
{
    if (isset($GLOBALS["user_status_table_executed"])) {
        if ($GLOBALS["VERBOSE"]) {
            $trace = debug_backtrace();
            if (isset($trace[1])) {
                $called = " called by " . basename($trace[1]["file"]) . " {$trace[1]["function"]}() line {$trace[1]["line"]}";
                echo "user_status_table Already executed {$called}\n";
            }
        }
        return;
    }
    $GLOBALS["user_status_table_executed"] = true;
    $unix = new unix();
    $sock = new sockets();
    $timefile = "/usr/share/artica-postfix/ressources/databases/ZARAFA_DB_STATUS.db";
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $mns = $unix->file_time_min($timefile);
    if ($GLOBALS["VERBOSE"]) {
        echo "{$timefile} = {$mns}Mn\n";
    }
    if (!$GLOBALS["FORCE"]) {
        if (system_is_overloaded(basename(__FILE__))) {
            system_admin_events("Overload system, aborting", __FUNCTION__, __FILE__, __LINE__, "zarafa");
            return;
        }
        if ($mns < 180) {
            return;
        }
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $timeProcess = $unix->PROCCESS_TIME_MIN($pid);
            system_admin_events("{$pid}, task is already executed (since {$timeProcess}Mn}), aborting", __FUNCTION__, __FILE__, __LINE__, "zarafa");
            if ($timeProcess < 15) {
                return;
            }
            $kill = $unix->find_program("kill");
            unix_system_kill_force($pid);
            system_admin_events("{$pid}, killed (since {$timeProcess}Mn}), aborting", __FUNCTION__, __FILE__, __LINE__, "zarafa");
        }
    }
    @file_put_contents($pidfile, getmypid());
    @unlink($timefile);
    @file_put_contents($timefile, time());
    $ZarafaIndexPath = $sock->GET_INFO("ZarafaIndexPath");
    $ZarafaStoreOutsidePath = $sock->GET_INFO("ZarafaStoreOutsidePath");
    $ZarafaMySQLServiceType = $sock->GET_INFO("ZarafaMySQLServiceType");
    if (!is_numeric($ZarafaMySQLServiceType)) {
        $ZarafaMySQLServiceType = 1;
    }
    // $ZarafaMySQLServiceType =1 ou 2 /var/lib/mysql
    // $ZarafaMySQLServiceType =3 --> dedicated instance
    if ($ZarafaIndexPath == null) {
        $ZarafaIndexPath = "/var/lib/zarafa/index";
    }
    if ($ZarafaStoreOutsidePath == null) {
        $ZarafaStoreOutsidePath = "/var/lib/zarafa";
    }
    $ARRAY["ZARAFA_INDEX"] = $unix->DIRSIZE_BYTES($ZarafaIndexPath);
    if ($ZarafaMySQLServiceType == 1 or $ZarafaMySQLServiceType == 2) {
        $ARRAY["ZARAFA_DB"] = $unix->DIRSIZE_BYTES("/var/lib/mysql");
    }
    if ($ZarafaMySQLServiceType == 3) {
        $WORKDIR = $sock->GET_INFO("ZarafaDedicateMySQLWorkDir");
        if ($WORKDIR == null) {
            $WORKDIR = "/home/zarafa-db";
        }
        $ARRAY["ZARAFA_DB"] = $unix->DIRSIZE_BYTES($WORKDIR);
    }
    $ARRAY["ATTACHS"] = $unix->DIRSIZE_BYTES($ZarafaStoreOutsidePath);
    @file_put_contents($timefile, serialize($ARRAY));
    @chmod($timefile, 0750);
    unset($ARRAY);
    $zarafaadmin = $unix->find_program("zarafa-admin");
    $kill = $unix->find_program("kill");
    $pids = $unix->PIDOF_PATTERN_ALL("zarafa-admin -l");
    if (count($pids) > 0) {
        while (list($pid, $line) = each($pids)) {
            $time = $unix->PROCESS_TTL($pid);
            if ($time > 15) {
                $unix->_syslog("killing zarafa-admin -l pid {$pid} ({$time}mn)", basename(__FILE__));
                unix_system_kill_force($pid);
            }
        }
    }
    $pid = $unix->PIDOF_PATTERN("zarafa-admin -l");
    if ($unix->process_exists($pid)) {
        $unix->_syslog("zarafa-admin -l pid {$pid} still running", basename(__FILE__));
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "{$zarafaadmin} -l 2>&1\n--------------------------------------------------------------------\n";
    }
    exec("{$zarafaadmin} -l 2>&1", $results);
    while (list($num, $line) = each($results)) {
        $line = trim($line);
        if ($GLOBALS["VERBOSE"]) {
            echo "\"{$line}\"\n";
        }
        if (preg_match("#User list for\\s+(.+?)\\(#i", $line, $re)) {
            $ou = $re[1];
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:exec.zarafa.build.stores.php

示例2: process_timeexec

function process_timeexec()
{
    $unix = new unix();
    echo "<articadatascgi>" . $unix->PROCESS_TTL($_GET["pid"]) . "</articadatascgi>";
}
开发者ID:articatech,项目名称:artica,代码行数:5,代码来源:cmd.php

示例3: restore

function restore()
{
    $sock = new sockets();
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    if ($GLOBALS["VERBOSE"]) {
        echo "PID: {$pidfile}\n";
    }
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid)) {
        $TTL = $unix->PROCESS_TTL($pid);
        if ($TTL < 240) {
            return;
        }
        $kill = $unix->find_program("kill");
        unix_system_kill_force($pid);
    }
    @file_put_contents($pidfile, getmypid());
    $hostname = $unix->hostname_g();
    progress(10, "{mounting}");
    if (!restore_TestNas()) {
        system_admin_events("Mounting NAS filesystem report false", __FUNCTION__, __FILE__, __LINE__);
        progress(100, "{failed}");
        return;
    }
    $BackupArticaRestoreNASIpaddr = $sock->GET_INFO("BackupArticaRestoreNASIpaddr");
    $BackupArticaRestoreNASFolder = $sock->GET_INFO("BackupArticaRestoreNASFolder");
    $BackupArticaRestoreNASUser = $sock->GET_INFO("BackupArticaRestoreNASUser");
    $BackupArticaRestoreNASPassword = $sock->GET_INFO("BackupArticaRestoreNASPassword");
    $BackupArticaRestoreNASFolderSource = $sock->GET_INFO("BackupArticaRestoreNASFolderSource");
    $BackupArticaRestoreNetwork = $sock->GET_INFO("BackupArticaRestoreNetwork");
    $mountPoint = "/mnt/BackupArticaRestoreNAS";
    $BackupArticaRestoreNASFolderSource = str_replace("\\", "/", $BackupArticaRestoreNASFolderSource);
    $sourceDir = "{$mountPoint}/{$BackupArticaRestoreNASFolderSource}";
    $sourceDir = str_replace("//", "/", $sourceDir);
    if (!is_file("{$sourceDir}/BKVERSION.txt")) {
        progress(100, "{failed} BKVERSION.txt no such file");
        $mount = new mount("/var/log/artica-postfix/backup.debug");
        if ($mount->ismounted($mountPoint)) {
            $mount->umount($mountPoint);
        }
        return;
    }
    $time = trim(@file_get_contents("{$sourceDir}/BKVERSION.txt"));
    progress(15, "{backup} " . date("Y-m-d H:i:s"));
    progress(20, "{restoring_ldap_database}, {please_wait}...");
    Restore_ldap($sourceDir);
    progress(40, "{restoring_artica_settings}, {please_wait}...");
    restore_artica_settings($sourceDir);
    progress(50, "{restoring_artica_databases}, {please_wait}...");
    restore_artica_backup($sourceDir);
    progress(60, "{restoring_artica_databases}, {please_wait}...");
    restore_ocsweb($sourceDir);
    progress(80, "{restoring_artica_databases}, {please_wait}...");
    restore_squidlogs($sourceDir);
    progress(82, "{restoring} PowerDNS, {please_wait}...");
    restore_powerdns($sourceDir);
    progress(90, "{reconfigure_server}, {please_wait}...");
    $squidbin = $unix->LOCATE_SQUID_BIN();
    $php = $unix->LOCATE_PHP5_BIN();
    if (is_file($squidbin)) {
        shell_exec("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
    }
    progress(100, "{success}");
    $mount = new mount("/var/log/artica-postfix/backup.debug");
    if ($mount->ismounted($mountPoint)) {
        $mount->umount($mountPoint);
    }
    if ($BackupArticaRestoreNetwork == 1) {
        $unix->THREAD_COMMAND_SET("{$php} /usr/share/artica-postfix/exec.virtuals-ip.php --build");
    }
    return;
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:73,代码来源:exec.backup.artica.php

示例4: restart

function restart()
{
    if (!is_run()) {
        echo "Starting......: " . date("H:i:s") . " WINBIND (restart) not running, start it...\n";
        Winbindd_events("Winbindd (restart) not running, start it", __FUNCTION__, __LINE__);
        start(true);
        return;
    }
    $unix = new unix();
    $php5 = $unix->LOCATE_PHP5_BIN();
    $filetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $time = $unix->file_time_min($filetime);
    Winbindd_events("Winbindd ask to restart since {$time}Mn", __FUNCTION__, __LINE__);
    if (!$GLOBALS["FORCE"]) {
        if ($time < 59) {
            $pid = WINBIND_PID();
            if ($unix->process_exists($pid)) {
                $timepid = $unix->PROCESS_TTL($pid);
                echo "Starting......: " . date("H:i:s") . " WINBIND ask to restart need to wait 60Mn pid:{$pid} {$timepid}\n";
                Winbindd_events("Winbindd ask to restart need to wait 60Mn pid:{$pid} {$timepid}", __FUNCTION__, __LINE__);
                return;
            } else {
                echo "Starting......: " . date("H:i:s") . " WINBIND (restart) not running, start it...\n";
                shell_exec("{$php5} /usr/share/artica-postfix/exec.winbindd.php --start");
            }
        }
    }
    @unlink($filetime);
    @file_put_contents($filetime, time());
    $smbcontrol = $unix->find_program("smbcontrol");
    $chmod = $unix->find_program("chmod");
    $settings = new settings_inc();
    DirsPrivileges();
    if (!$GLOBALS["FORCE"]) {
        if (is_file($smbcontrol)) {
            Winbindd_events("Winbindd reloading", __FUNCTION__, __LINE__);
            echo "Starting......: " . date("H:i:s") . " WINBIND reloading...\n";
            shell_exec("{$smbcontrol} winbindd reload-config");
            shell_exec("{$smbcontrol} winbindd offline");
            shell_exec("{$smbcontrol} winbindd online");
            setfacl_squid();
            return;
        }
    }
    Winbindd_events("Winbindd stop", __FUNCTION__, __LINE__);
    stop();
    Winbindd_events("Winbindd ask to start", __FUNCTION__, __LINE__);
    start(true);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:49,代码来源:exec.winbindd.php

示例5: dirname

<?php

include dirname(__FILE__) . '/ressources/class.qos.inc';
include_once dirname(__FILE__) . '/framework/frame.class.inc';
include_once dirname(__FILE__) . '/framework/class.unix.inc';
include_once dirname(__FILE__) . '/ressources/class.artica-meta.inc';
include_once dirname(__FILE__) . '/ressources/class.ldap.inc';
include_once dirname(__FILE__) . '/ressources/class.computers.inc';
include_once dirname(__FILE__) . '/ressources/class.sockets.inc';
include_once dirname(__FILE__) . '/ressources/class.groups.inc';
include_once dirname(__FILE__) . '/ressources/class.http.pear.inc';
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid)) {
    $ptime = $unix->PROCESS_TTL($pid);
    die;
}
if ($argv[1] == '--org') {
    export($argv[2], $argv[3]);
}
if ($argv[1] == '--upload') {
    export_ou_http($argv[2], $argv[3]);
}
function export_ou_http($ou, $session)
{
    $sock = new sockets();
    $ldap = new clladp();
    $path = "/root";
    echo "Exporting meta informations session {$session} for ou=`{$ou}`\n";
    export($ou, $path);
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:exec.export-users.php

示例6: start

function start()
{
    $unix = new unix();
    $pid = getmypid();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "pidTime: {$pidTime}\n";
    }
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid)) {
        if ($pid != $pid) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            if ($time > 120) {
                ToSyslog("killing {$pid}  (line:  Line: " . __LINE__ . ")");
                unix_system_kill_force($pid);
            } else {
                die;
            }
        }
    }
    @file_put_contents($pidfile, getmypid());
    $pidTimeEx = $unix->file_time_min($pidTime);
    if (!$GLOBALS["FORCE"]) {
        if ($pidTimeEx < 240) {
            ToSyslog("Waiting 240mn minimal - current ({$pidTimeEx}Mn)");
            return;
        }
    }
    @unlink($pidTime);
    @file_put_contents($pidTime, time());
    $ARRAY = array();
    $curlftps = $unix->find_program("curlftpfs");
    $pgrep = $unix->find_program("pgrep");
    exec("{$pgrep} -l -f \"{$curlftps}\" 2>&1", $results);
    while (list($index, $line) = each($results)) {
        $line = trim($line);
        if ($line == null) {
            continue;
        }
        $MOUNTED = null;
        $pidtime = 0;
        $pid = 0;
        if (preg_match("#pgrep#", $line)) {
            continue;
        }
        if (preg_match("#^([0-9]+)\\s+(.+)#", $line, $re)) {
            $pid = $re[1];
            $pidtime = $unix->PROCESS_TTL($pid);
            $cmdline = trim($re[2]);
            $cmdline = str_replace($curlftps, "", $cmdline);
            $cmdline = trim($re[2]);
            if ($GLOBALS["VERBOSE"]) {
                echo "Found {$pid} {$pidtime}Mn [{$cmdline}]\n";
            }
            $ARRAY[$pid]["TIME"] = $pidtime;
            if ($GLOBALS["VERBOSE"]) {
                echo "Explode {$cmdline}\n";
            }
            $TR = explode(" ", $cmdline);
            while (list($index2, $bg) = each($TR)) {
                if ($GLOBALS["VERBOSE"]) {
                    echo "Checks {$bg}\n";
                }
                if (substr($bg, 0, 1) == "/") {
                    $MOUNTED = $bg;
                    if ($GLOBALS["VERBOSE"]) {
                        echo "Found {$pid} {$pidtime}Mn mounted on {$bg}\n";
                    }
                    $ARRAY[$pid]["MOUNTED"] = $MOUNTED;
                    break;
                }
            }
        }
    }
    if (count($ARRAY) == 0) {
        return;
    }
    $umount = $unix->find_program("umount");
    while (list($pid, $ar) = each($ARRAY)) {
        $TIME = $ar["TIME"];
        $MOUNTED = $ar["MOUNTED"];
        if ($TIME < 960) {
            continue;
        }
        ToSyslog("Umounting curlftps process id {$pid} mounted on {$MOUNTED} and running since {$TIME}mn, and exceed 960mn");
        shell_exec("{$umount} -l {$MOUNTED}");
        if ($unix->process_exists($pid)) {
            ToSyslog("Killing curlftps process id {$pid}");
            $unix->KILL_PROCESS($pid, 9);
        }
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:93,代码来源:exec.curlftps.watchdog.php

示例7: reload

function reload($aspid = false)
{
    $unix = new unix();
    if (!$aspid) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            if ($GLOBALS["OUTPUT"]) {
                echo "Reloading.....: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service Already Artica task running PID {$pid} since {$time}mn\n";
            }
            return;
        }
        @file_put_contents($pidfile, getmypid());
    }
    $amavisbin = $unix->LOCATE_AMAVISD_BIN_PATH();
    $pid = PID_NUM();
    if (!$unix->process_exists($pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Reloading.....: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Not running\n";
        }
        start(true);
        return;
    }
    $TTL = $unix->PROCESS_TTL($pid);
    $nohup = $unix->find_program("nohup");
    if ($GLOBALS["OUTPUT"]) {
        echo "Reloading.....: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} reloading PID {$pid} running since {$TTL}mn\n";
    }
    buildconfig();
    $cmd = "{$nohup} {$amavisbin} -c /usr/local/etc/amavisd.conf reload >/dev/null 2>&1 &";
    shell_exec($cmd);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:33,代码来源:exec.amavis.php

示例8: start

function start($aspid = false)
{
    $unix = new unix();
    $sock = new sockets();
    $Masterbin = $unix->find_program("ufdbgclient");
    if (!is_file($Masterbin)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, ufdbgclient not installed\n";
        }
        return false;
    }
    if (!$aspid) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
            }
            return true;
        }
        @file_put_contents($pidfile, getmypid());
    }
    $sock = new sockets();
    $EnableUfdbGuard = intval($sock->EnableUfdbGuard());
    $SquidUFDBUrgency = intval($sock->GET_INFO("SquidUFDBUrgency"));
    if ($SquidUFDBUrgency == 1) {
        $EnableUfdbGuard = 0;
    }
    if ($EnableUfdbGuard == 0) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, Not Enabled\n";
        }
        return false;
    }
    $pids = GetAllPids();
    if (count($pids) > 0) {
        while (list($pid, $none) = each($pids)) {
            $ttl = $unix->PROCESS_TTL($pid);
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, already running PID {$pid} since {$ttl}Mn\n";
            }
        }
        return true;
    }
    if (IsInSquid()) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, Hooked chock proxy\n";
        }
        squid_admin_mysql(1, "Reload proxy service to run Web filtering clients.", null, __FILE__, __LINE__);
        $squidbin = $unix->LOCATE_SQUID_BIN();
        system("{$squidbin} -f /etc/squid3/squid.conf -k reconfigure");
    } else {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, Not Hooked! Hook proxy\n";
        }
        EnableClient();
    }
    for ($i = 1; $i < 8; $i++) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, Waiting {$i}/5\n";
        }
        sleep(1);
        $pids = GetAllPids();
        if (count($pids) > 0) {
            break;
        }
    }
    $pids = GetAllPids();
    if (count($pids) > 0) {
        while (list($pid, $none) = each($pids)) {
            $ttl = $unix->PROCESS_TTL($pid);
            $fty[] = "Success PID {$pid} since {$ttl}Mn";
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Success PID {$pid} since {$ttl}Mn\n";
            }
        }
        squid_admin_mysql(2, "Succes {starting_web_filtering} Client service from the proxy{$GLOBALS["ADPLUS"]}", @implode("\n", $fty), __FILE__, __LINE__);
        return true;
    } else {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, Failed\n";
        }
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:85,代码来源:exec.ufdb-client.php

示例9: Checks_mgrinfos

function Checks_mgrinfos($MonitConfig, $aspid = false)
{
    $sock = new sockets();
    $unix = new unix();
    $php5 = $unix->LOCATE_PHP5_BIN();
    $SystemInfoCache = "/etc/squid3/squid_get_system_info.db";
    $StoreDirCache = "/etc/squid3/squid_storedir_info.db";
    if (!is_array($MonitConfig)) {
        $MonitConfig = unserialize(base64_decode($sock->GET_INFO("SquidWatchdogMonitConfig")));
        $MonitConfig = watchdog_config_default($MonitConfig);
    }
    $FailOverArticaParams = FailOverParams();
    $MgrInfosMaxTimeOut = $MonitConfig["MgrInfosMaxTimeOut"];
    $MgrInfosRestartFailed = $MonitConfig["MgrInfosRestartFailed"];
    $MgrInfosFaileOverFailed = $MonitConfig["MgrInfosFaileOverFailed"];
    $MgrInfosMaxFailed = $MonitConfig["MgrInfosFaileOverFailed"];
    $MgrInfosMaxFailedCount = @file_get_contents("/etc/squid3/MgrInfosMaxFailedCount");
    if (!is_numeric($MgrInfosMaxFailedCount)) {
        $MgrInfosMaxFailedCount = 0;
    }
    if (!$aspid) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            if ($time > 5) {
                $kill = $unix->find_program("kill");
                Events("kill old {$pid} process {$time}mn");
                unix_system_kill_force($pid);
            } else {
                system_admin_events("Start_squid:: Already task running PID {$pid} since {$time}mn", __FUNCTION__, __FILE__, __LINE__, "proxy");
                return;
            }
        }
    }
    @file_put_contents($pidfile, getmypid());
    $squidpid = SQUID_PID();
    if (!$unix->process_exists($squidpid)) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Squid not running aborting\n";
        }
        $GLOBALS["ALL_SCORES"]++;
        $GLOBALS["ALL_SCORES_WHY"][] = "function " . __FUNCTION__ . " return Squid not running";
        return;
    }
    $rpcesstime = $unix->PROCESS_TTL($squidpid);
    if ($rpcesstime < 5) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Squid running since {$rpcesstime}mn, need 5mn\n";
        }
        return;
    }
    if (is31()) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Only squid 3.1x... aborting\n";
        }
        Checks_mgrinfos_31();
        return;
    }
    $SquidMgrListenPort = trim($sock->GET_INFO("SquidMgrListenPort"));
    if (!is_numeric($SquidMgrListenPort) or $SquidMgrListenPort == 0) {
        $SquidBinIpaddr = $sock->GET_INFO("SquidBinIpaddr");
        if ($SquidBinIpaddr == null) {
            $SquidBinIpaddr = "127.0.0.1";
        }
        $http_port = squid_get_alternate_port();
        if (preg_match("#(.+?):([0-9]+)#", $http_port, $re)) {
            $SquidBinIpaddr = $re[1];
            if ($SquidBinIpaddr == "0.0.0.0") {
                $SquidBinIpaddr = "127.0.0.1";
            }
            $http_port = $re[2];
        }
    } else {
        $SquidBinIpaddr = "127.0.0.1";
        $http_port = $SquidMgrListenPort;
    }
    $t0 = time();
    $curl = new ccurl("http://{$SquidBinIpaddr}:{$http_port}/squid-internal-mgr/info", true);
    $curl->CURLOPT_NOPROXY = $SquidBinIpaddr;
    $curl->ArticaProxyServerEnabled == "no";
    $curl->interface = "127.0.0.1";
    $curl->Timeout = $MgrInfosMaxTimeOut;
    $curl->UseDirect = true;
    if (!$curl->get()) {
        $MgrInfosMaxFailedCount++;
        if ($MgrInfosRestartFailed == 1) {
            squid_admin_mysql(0, "Unable to retreive informations [{$MgrInfosMaxFailedCount}/{$MgrInfosMaxFailed}] from {$SquidBinIpaddr}:{$http_port}", $curl->errors, __FILE__, __LINE__);
        }
        if ($MgrInfosRestartFailed == 0) {
            squid_admin_mysql(1, "Unable to retreive informations [{$MgrInfosMaxFailedCount}/{$MgrInfosMaxFailed}] from {$SquidBinIpaddr}:{$http_port}", $curl->errors, __FILE__, __LINE__);
        }
        if ($MgrInfosMaxFailedCount <= $MgrInfosMaxFailed) {
            @file_put_contents("/etc/squid3/MgrInfosMaxFailedCount", $MgrInfosMaxFailedCount);
            return true;
        }
        @file_put_contents("/etc/squid3/MgrInfosMaxFailedCount", 0);
        if ($MonitConfig["watchdog"] == 1) {
            if ($MgrInfosFaileOverFailed == 1) {
                FailOverDown("Unable to retreive informations [{$MgrInfosMaxFailedCount}/{$MgrInfosMaxFailed}] from {$SquidBinIpaddr}:{$http_port}, {$curl->error}");
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:exec.squid.watchdog.php

示例10: phpcgi

function phpcgi()
{
    $unix = new unix();
    $phpcgi = $unix->LIGHTTPD_PHP5_CGI_BIN_PATH();
    $pids = $unix->PIDOF_PATTERN_ALL($phpcgi);
    if (count($pids) == 0) {
        return;
    }
    $c = 0;
    while (list($pid, $ligne) = each($pids)) {
        $time = $unix->PROCESS_TTL($pid);
        if ($time > 1640) {
            $c++;
            $unix->KILL_PROCESS($pid, 9);
        }
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:17,代码来源:exec.lighttpd.php

示例11: stop_ldap

function stop_ldap($aspid = false)
{
    if ($GLOBALS["MONIT"]) {
        xsyslog("Not accept a stop order from MONIT process");
        return;
    }
    $sock = new sockets();
    $users = new usersMenus();
    $ldaps = array();
    $unix = new unix();
    $kill = $unix->find_program("kill");
    $slapd = $unix->find_program("slapd");
    $pgrep = $unix->find_program("pgrep");
    $SLAPD_PID_FILE = $unix->SLAPD_PID_PATH();
    $MYPID_FILE = "/etc/artica-postfix/pids/stop_ldap.pid";
    if ($users->ZARAFA_INSTALLED) {
        stop_zarafa();
    }
    if (!$aspid) {
        $pid = $unix->get_pid_from_file($MYPID_FILE);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $pidtime = $unix->PROCCESS_TIME_MIN($pid);
            echo "slapd: [INFO] Artica task already running pid {$pid} since {$pidtime}mn\n";
            if ($pidtime > 10) {
                echo "slapd: [INFO] Killing this Artica task...\n";
                unix_system_kill_force($pid);
            } else {
                die;
            }
        }
        @unlink($MYPID_FILE);
        @file_put_contents($MYPID_FILE, getmypid());
    }
    $pid = $unix->get_pid_from_file($SLAPD_PID_FILE);
    $pid = $unix->get_pid_from_file($SLAPD_PID_FILE);
    if ($unix->process_exists($pid)) {
        $timeDaemon = $unix->PROCESS_TTL($pid);
        $unix->ToSyslog("Stopping the OpenLDAP daemon running since {$timeDaemon}Mn", false, basename(__FILE__));
        echo "slapd: [INFO] slapd shutdown ldap server PID:{$pid}...\n";
        unix_system_kill($pid);
    } else {
        $pid = $unix->PIDOF($slapd);
        if ($unix->process_exists($pid)) {
            echo "slapd: [INFO] slapd shutdown ldap server PID:{$pid}...\n";
            unix_system_kill($pid);
        }
    }
    for ($i = 0; $i < 10; $i++) {
        $pid = intval($unix->get_pid_from_file($SLAPD_PID_FILE));
        if ($pid == 0) {
            break;
        }
        restart_ldap_progress("{stopping_service} stop PID:{$pid}", 20);
        if ($unix->process_exists($pid)) {
            echo "slapd: [INFO] slapd waiting the server to stop PID:{$pid}...\n";
            sleep(1);
            continue;
        }
        $pid = $unix->PIDOF($slapd);
        if ($unix->process_exists($pid)) {
            echo "slapd: [INFO] slapd waiting the server to stop PID:{$pid}...\n";
            sleep(1);
            continue;
        }
    }
    $pid = $unix->get_pid_from_file($SLAPD_PID_FILE);
    if ($unix->process_exists($pid)) {
        echo "slapd: [INFO] slapd PID:{$pid} still exists, kill it...\n";
        unix_system_kill_force($pid);
    }
    $pid = $unix->get_pid_from_file($SLAPD_PID_FILE);
    if ($unix->process_exists($pid)) {
        echo "slapd: [INFO] slapd PID:{$pid} still exists, start the force kill procedure...\n";
    }
    restart_ldap_progress("{stopping_service} Checking {$slapd}", 25);
    $pid = $unix->PIDOF($slapd);
    if ($unix->process_exists($pid)) {
        echo "slapd: [INFO] slapd PID:{$pid} still exists, kill it...\n";
        unix_system_kill_force($pid);
        return;
    }
    restart_ldap_progress("{stopping_service} Checking {$slapd}", 28);
    exec("{$pgrep} -l -f {$slapd} 2>&1", $results);
    while (list($num, $line) = each($results)) {
        if (preg_match("#pgrep#", $line)) {
            continue;
        }
        if (preg_match("^([0-9]+)\\s+", $line, $re)) {
            echo "slapd: [INFO] slapd PID:{$re[1]} still exists, kill it\n";
            unix_system_kill_force($re[1]);
        }
    }
    restart_ldap_progress("{stopping_service} {success}", 30);
    echo "slapd: [INFO] slapd stopped, success...\n";
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:95,代码来源:exec.initslapd.php

示例12: start_import

function start_import($aspid = false)
{
    $sock = new sockets();
    $syslog = new mysql_storelogs();
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $unix = new unix();
    if (!$aspid) {
        $pid = @file_get_contents($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCESS_TTL($pid);
            stats_admin_events(2, "A already Importation Task is executed pid:{$pid} since {$time}Mn", null, __FILE__, __LINE__);
            writelogs("Already executed pid:{$pid}", __FUNCTION__, __FILE__, __LINE__);
            return;
        }
        $pid = @file_get_contents("/var/run/squid-stats-central.pid");
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCESS_TTL($pid);
            stats_admin_events(2, "An anlready Importation Task is executed pid:{$pid} since {$time}Mn", null, __FILE__, __LINE__);
            writelogs("Already executed pid:{$pid}", __FUNCTION__, __FILE__, __LINE__);
            return;
        }
    }
    $import_processes = import_processes();
    if ($import_processes > 6) {
        Import_logs("Too many processes ({$import_processes})...aborting task...");
        return;
    }
    $mypid = getmypid();
    @file_put_contents($pidfile, $mypid);
    $ArticaProxyStatisticsBackupFolder = $sock->GET_INFO("ArticaProxyStatisticsBackupFolder");
    if ($ArticaProxyStatisticsBackupFolder == null) {
        $ArticaProxyStatisticsBackupFolder = "/home/artica/squid/backup-statistics";
    }
    $ArticaProxyStatisticsBackupFolder = $ArticaProxyStatisticsBackupFolder . "/import";
    $files = $unix->DirFiles($ArticaProxyStatisticsBackupFolder);
    if ($GLOBALS["VERBOSE"]) {
        echo "PUSH Scanning {$ArticaProxyStatisticsBackupFolder}\n";
    }
    $mysql = $unix->find_program("mysql");
    $bzip2 = $unix->find_program("bzip2");
    $total = count($files);
    $c = 0;
    if ($total == 0) {
        return;
    }
    stats_admin_events(2, "Importing {$total} files to MySQL", null, __FILE__, __LINE__);
    while (list($filename, $none) = each($files)) {
        $c++;
        if (if_process_import_exists($filename)) {
            Import_logs("SKIP {$ArticaProxyStatisticsBackupFolder}/{$filename} Already running...");
            continue;
        }
        percentage("Extracting {$filename} {$c}/{$total}", 2);
        $size = @filesize("{$ArticaProxyStatisticsBackupFolder}/{$filename}");
        Import_logs("IMPORT {$ArticaProxyStatisticsBackupFolder}/{$filename}");
        $f = array();
        $results = array();
        $f[] = "{$bzip2} -d -c {$ArticaProxyStatisticsBackupFolder}/{$filename} |";
        $f[] = "{$mysql} --show-warnings";
        $f[] = "--socket=/var/run/mysqld/squid-db.sock";
        $f[] = "--protocol=socket --user=root --batch --force";
        $f[] = "--debug-info --database=squidlogs 2>&1";
        $cmd = @implode(" ", $f);
        $results[] = $cmd;
        percentage("Importing {$filename} to MySQL {$c}/{$total}", 2);
        exec($cmd, $results);
        Import_logs(@implode("\n", $results));
        stats_admin_events(2, "Success importing {$filename} to MySQL", @implode("\n", $results), __FILE__, __LINE__);
        Import_logs("Backup {$ArticaProxyStatisticsBackupFolder}/{$filename}");
        $syslog->ROTATE_TOMYSQL("{$ArticaProxyStatisticsBackupFolder}/{$filename}");
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:73,代码来源:exec.squid.stats.central.php

示例13: SERVICE_RESTART

function SERVICE_RESTART()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pid = @file_get_contents($pidfile);
    $kill = $unix->find_program("kill");
    $LastExec = $unix->file_time_min($pidTime);
    if (!$GLOBALS["BY_WIZARD"]) {
        if ($LastExec < 1) {
            $unix->ToSyslog("Restarting MySQL service Aborted Need at least 1mn", true, basename(__FILE__));
            return;
        }
    }
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        if ($time < 5) {
            $unix->ToSyslog("Restarting MySQL service Aborted an artica task {$pid} is running", true, basename(__FILE__));
            return;
        }
        $unix->ToSyslog("Killing `Restart task` Running too long {$time}Mn");
        unix_system_kill_force($pid);
    }
    $unix->ToSyslog("Restarting MySQL service `{$GLOBALS["CMDLINE"]}`", true, basename(__FILE__));
    if ($GLOBALS["FORCE"]) {
        mysql_admin_mysql(0, "Restarting MySQL using Force mode !", __FILE__, __LINE__);
    }
    if ($GLOBALS["BY_FRAMEWORK"] == null) {
        $unix->ToSyslog("Restarting MySQL server without specify --framework!", true, basename(__FILE__));
        if ($unix->is_socket("/var/run/mysqld/mysqld.sock")) {
            echo "Restarting....: " . date("H:i:s") . " MySQL socket seems ok\n";
            $unix->ToSyslog("MySQL, socket seems ok", true, basename(__FILE__));
        }
        $pid = PID_NUM();
        if (!$unix->process_exists($pid)) {
            mysql_admin_mysql(0, "Starting MySQL server by=[{$GLOBALS["BY_FRAMEWORK"]}] Service is not running,  start it", __FILE__, __LINE__);
            SERVICE_START(false, true);
            return;
        }
        $time = $unix->PROCESS_TTL($pid);
        echo "Restarting....: " . date("H:i:s") . " MySQL running since {$time}Mn\n";
        $unix->ToSyslog("MySQL, PID {$pid} running since {$time}Mn, nothing to do, not make sense...", true, basename(__FILE__));
        echo "Restarting MySQL service can only done by using \"--force --framework\" token\n";
        echo "Use /etc/init.d/mysql restart --force --framework=byhand\n";
        return;
    }
    if ($GLOBALS["BY_SOCKET_FAILED"]) {
        echo "Restarting....: " . date("H:i:s") . " MySQL Seems socket is failed\n";
        $unix->ToSyslog("MySQL, Seems socket is failed...", true, basename(__FILE__));
    }
    if ($GLOBALS["BY_SOCKET_FAILED"]) {
        if ($unix->is_socket("/var/run/mysqld/mysqld.sock")) {
            mysql_admin_mysql(0, "Watchdog say that the socket is failed but find it..aborting", __FILE__, __LINE__);
            return;
        } else {
            mysql_admin_mysql(2, "Watchdog say that the socket is failed and did not find it...", __FILE__, __LINE__);
        }
    }
    $pid = PID_NUM();
    if (!$unix->process_exists($pid)) {
        mysql_admin_mysql(0, "Restarting MySQL server by=[{$GLOBALS["BY_FRAMEWORK"]}] Service is not running,  start it", __FILE__, __LINE__);
        SERVICE_START(false, true);
        return;
    }
    $time = $unix->PROCESS_TTL($pid);
    mysql_admin_mysql(0, "Restarting MySQL server running since {$time}Mn by=[{$GLOBALS["BY_FRAMEWORK"]}]...", __FILE__, __LINE__);
    SERVICE_STOP(true);
    SERVICE_START(false, true);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:69,代码来源:exec.mysql.start.php

示例14: start

function start($aspid = false)
{
    $unix = new unix();
    $sock = new sockets();
    $Masterbin = $unix->find_program("ufdbgclient");
    if (!is_file($Masterbin)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, ufdbgclient not installed\n";
        }
        return false;
    }
    if (!$aspid) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
            }
            return true;
        }
        @file_put_contents($pidfile, getmypid());
    }
    $sock = new sockets();
    $EnableUfdbGuard = $sock->EnableUfdbGuard();
    if ($EnableUfdbGuard == 0) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, Not Enabled\n";
        }
        return false;
    }
    $pids = GetAllPids();
    if (count($pids) > 0) {
        while (list($pid, $none) = each($pids)) {
            $ttl = $unix->PROCESS_TTL($pid);
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, already running PID {$pid} since {$ttl}Mn\n";
            }
        }
        return true;
    }
    if (IsInSquid()) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, Hooked chock proxy\n";
        }
        shell_exec("/etc/init.d/squid reload --script=" . basename(__FILE__));
    } else {
        EnableClient();
    }
    for ($i = 1; $i < 8; $i++) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, Waiting {$i}/5\n";
        }
        sleep(1);
        $pids = GetAllPids();
        if (count($pids) > 0) {
            break;
        }
    }
    $pids = GetAllPids();
    if (count($pids) > 0) {
        while (list($pid, $none) = each($pids)) {
            $ttl = $unix->PROCESS_TTL($pid);
            $fty[] = "Success PID {$pid} since {$ttl}Mn";
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Success PID {$pid} since {$ttl}Mn\n";
            }
        }
        squid_admin_mysql(2, "Succes starting Web Filtering Client service from the proxy{$GLOBALS["ADPLUS"]}", @implode("\n", $fty), __FILE__, __LINE__);
        return true;
    } else {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, Failed\n";
        }
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:76,代码来源:exec.ufdb-client.php

示例15: SendStatus

function SendStatus()
{
    emergency(true);
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $sock = new sockets();
    $EnableSargGenerator = $sock->GET_INFO("EnableSargGenerator");
    if (TestsCron($pidfile)) {
        $ArticaMetaPingEnable = $sock->GET_INFO("ArticaMetaPingEnable");
        events("SendPing={$ArticaMetaPingEnable}", __FUNCTION__, __FILE__, __LINE__);
        if ($ArticaMetaPingEnable == 1) {
            SendPing();
        }
        return true;
    }
    $ArticaMetaEnabled = $sock->GET_INFO("ArticaMetaEnabled");
    if ($ArticaMetaEnabled != 1) {
        return;
    }
    $t1 = time();
    if (!is_file("/usr/share/artica-postfix/ressources/logs/global.status.ini")) {
        events("Unable to stat /usr/share/artica-postfix/ressources/logs/global.status.ini", __FUNCTION__, __FILE__, __LINE__);
        return null;
    }
    $unix = new unix();
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $ptime = $unix->PROCESS_TTL($pid);
        if ($ptime > $GLOBALS["MAXTTL"]) {
            events("killing process {$pid} ttl:{$ptime} minutes", __FUNCTION__, __FILE__, __LINE__);
            unix_system_kill_force($pid);
        } else {
            events("Already executed, process {$pid}", __FUNCTION__, __FILE__, __LINE__);
            die;
        }
    }
    events("Running pid " . getmypid(), __FUNCTION__, __FILE__, __LINE__);
    @file_put_contents($pidfile, getmypid());
    CheckNetwork();
    $http = new httpget();
    $meta = new artica_meta();
    $filecache = "/etc/artica-postfix/artica-meta-files.cache";
    events("My uuid=\"{$meta->uuid}\"", __FUNCTION__, __FILE__, __LINE__);
    $memCache = "/usr/share/artica-postfix/ressources/logs/status.memory.hash";
    $cpu_graphs = "/opt/artica/share/www/system/rrd/01cpu-1day.png";
    $server_status = "/usr/share/artica-postfix/ressources/logs/status.right.1.html";
    $squid_realtime = "/etc/artica-postfix/squid-realtime.cache";
    $datasToSend = base64_encode(serialize($meta->GLOBAL_ARRAY));
    $ini = new Bs_IniHandler();
    $ini->loadFile("/usr/share/artica-postfix/ressources/logs/global.status.ini");
    $ArrayFileCache = unserialize(@file_get_contents($filecache));
    if (is_file($memCache)) {
        $MEM_CACHE = base64_encode(@file_get_contents($memCache));
    } else {
        include_once "ressources/class.os.system.tools.inc";
        $os = new os_system();
        $os->html_Memory_usage();
        $MEM_CACHE = base64_encode(serialize($os->meta_array));
    }
    if (is_file($cpu_graphs)) {
        if ($ArrayFileCache["STATS_DAY"] != filemtime($cpu_graphs)) {
            $http->uploads["STATS_DAY"] = $cpu_graphs;
            $ArrayFileCache["STATS_DAY"] = filemtime($cpu_graphs);
            @file_put_contents($filecache, serialize($ArrayFileCache));
        }
    }
    if (is_file($server_status)) {
        if ($ArrayFileCache["SERVER_STATUS"] != filemtime($server_status)) {
            $http->uploads["SERVER_STATUS"] = $server_status;
            $ArrayFileCache["SERVER_STATUS"] = filemtime($server_status);
            @file_put_contents($filecache, serialize($ArrayFileCache));
        }
    }
    if (is_file($squid_realtime)) {
        if ($ArrayFileCache["SQUID_REALTIME"] != filemtime($squid_realtime)) {
            $http->uploads["SQUID_REALTIME"] = $squid_realtime;
            $ArrayFileCache["SQUID_REALTIME"] = filemtime($squid_realtime);
            @file_put_contents($filecache, serialize($ArrayFileCache));
        }
    }
    if ($EnableSargGenerator == 1) {
        $push_sarg = false;
        $sock = new sockets();
        $SargOutputDir = $sock->GET_INFO("SargOutputDir");
        if ($SargOutputDir == null) {
            $SargOutputDir = "/var/www/html/squid-reports";
        }
        if (is_file("{$SargOutputDir}/index.html")) {
            if (!is_file("/etc/artica-postfix/sarg.tgz")) {
                shell_exec("cd {$SargOutputDir} && tar -cjf /etc/artica-postfix/sarg.tgz ./*");
                $push_sarg = true;
            } else {
                if ($ArrayFileCache["SQUID_SARG"] != filemtime("{$SargOutputDir}/index.html")) {
                    @unlink("/etc/artica-postfix/sarg.tgz");
                    shell_exec("cd {$SargOutputDir} && tar -cjf /etc/artica-postfix/sarg.tgz ./*");
                    $push_sarg = true;
                }
            }
            if ($push_sarg) {
                $http->uploads["SQUID_SARG"] = "/etc/artica-postfix/sarg.tgz";
            }
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.artica.meta.php


注:本文中的unix::PROCESS_TTL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。