Ejemplo n.º 1
0
function ALL_STATUS($aspid = false)
{
    $unix = new unix();
    if ($GLOBALS["VERBOSE"]) {
        $cmdline_verbose = " --verbose";
        $GLOBALS["OUTPUT"] = true;
    }
    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 "Stopping......: " . date("H:i:s") . "Already `task` running PID {$pid} since {$time}mn\n";
            }
            system_admin_events("stop_squid::Already task running PID {$pid} since {$time}mn", __FUNCTION__, __FILE__, __LINE__, "proxy");
            return;
        }
        @file_put_contents($pidfile, getmypid());
    }
    build_progress_status("verify_var_log()", 2);
    verify_var_log();
    squeezer();
    build_progress_status("squid_stores_status()", 5);
    squid_stores_status();
    build_progress_status("squid_mem_status()", 8);
    squid_mem_status();
    build_progress_status("squid_memory_monitor()", 9);
    squid_memory_monitor();
    build_progress_status("bandwith_stats_today()", 9);
    bandwith_stats_today();
    build_progress_status("squid_cache_mem_current()", 9);
    squid_cache_mem_current();
    build_progress_status("redirectors_array()", 9);
    redirectors_array();
    $php5 = $unix->LOCATE_PHP5_BIN();
    build_progress_status("CheckGlobalInfos()", 10);
    CheckGlobalInfos();
    build_progress_status("CheckRequestsStats()", 15);
    CheckRequestsStats();
    build_progress_status("ALLKIDS()", 20);
    ALLKIDS();
    build_progress_status("C_ICAP_CLIENTS()", 22);
    C_ICAP_CLIENTS();
    build_progress_status("squid_stores_status()", 30);
    squid_stores_status();
    build_progress_status("{caches_center} {status}", 30);
    cache_center_status();
    if ($GLOBALS["FORCE"]) {
        build_progress_status("CacheInfos()", 50);
        system("{$php5} /usr/share/artica-postfix/exec.squid.php --cache-infos --force{$cmdline_verbose}");
        build_progress_status("{caches_center}", 60);
        system("{$php5} " . __FILE__ . " --caches-center --force{$cmdline_verbose}");
    }
    build_progress_status("Done...", 100);
}
Ejemplo n.º 2
0
function ALL_STATUS($aspid = false)
{
    if (is_file("/usr/bin/cgclassify")) {
        if (is_dir("/cgroups/blkio/php")) {
            shell_exec("/usr/bin/cgclassify -g cpu,cpuset,blkio:php " . getmypid());
        }
    }
    $unix = new unix();
    if (!is_file("/usr/sbin/mgr-info")) {
        $ln = $unix->find_program("ln");
        shell_exec("{$ln} -sf " . dirname(__FILE__) . "/exec.cmdline.squid.cache.mem.php /usr/sbin/mgr-info");
        @chmod(dirname(__FILE__) . "/exec.cmdline.squid.cache.mem.php", 0755);
    }
    if ($GLOBALS["VERBOSE"]) {
        $cmdline_verbose = " --verbose";
        $GLOBALS["OUTPUT"] = true;
    }
    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 "Stopping......: " . date("H:i:s") . "Already `task` running PID {$pid} since {$time}mn\n";
            }
            system_admin_events("stop_squid::Already task running PID {$pid} since {$time}mn", __FUNCTION__, __FILE__, __LINE__, "proxy");
            return;
        }
        @file_put_contents($pidfile, getmypid());
    }
    build_progress_status("verify_var_log()", 2);
    verify_var_log();
    squeezer();
    build_progress_status("squid_stores_status()", 5);
    squid_stores_status();
    build_progress_status("squid_mem_status()", 8);
    squid_mem_status();
    build_progress_status("squid_memory_monitor()", 9);
    squid_memory_monitor();
    build_progress_status("bandwith_stats_today()", 9);
    bandwith_stats_today();
    build_progress_status("squid_cache_mem_current()", 9);
    squid_cache_mem_current();
    build_progress_status("redirectors_array()", 9);
    redirectors_array();
    build_progress_status("CATEGORIES_SERVICE()", 9);
    CATEGORIES_SERVICE();
    build_progress_status("dev_shm()", 9);
    dev_shm();
    build_progress_status("DisableGoogleSSL()", 9);
    DisableGoogleSSL();
    build_progress_status("CHECK_WIFIDOG_IPTABLES_RULES()", 9);
    CHECK_WIFIDOG_IPTABLES_RULES();
    build_progress_status("taskset()", 9);
    taskset();
    build_progress_status("CRON_NECESSARIES()", 9);
    CRON_NECESSARIES();
    build_progress_status("import_old_logs()", 9);
    import_old_logs();
    $php5 = $unix->LOCATE_PHP5_BIN();
    build_progress_status("CheckGlobalInfos()", 10);
    CheckGlobalInfos();
    build_progress_status("ALLKIDS()", 20);
    ALLKIDS();
    build_progress_status("C_ICAP_CLIENTS()", 22);
    C_ICAP_CLIENTS();
    build_progress_status("squid_stores_status()", 30);
    squid_stores_status();
    build_progress_status("{caches_center} {status}", 30);
    cache_center_status();
    eCapClamav();
    squid_conx();
    if ($GLOBALS["FORCE"]) {
        build_progress_status("CacheInfos()", 50);
        system("{$php5} /usr/share/artica-postfix/exec.squid.php --cache-infos --force --verbose");
        build_progress_status("{caches_center}", 60);
        system("{$php5} " . __FILE__ . " --caches-center --force{$cmdline_verbose}");
    }
    build_progress_status("Done...", 100);
}