Example #1
0
function work()
{
    //return;
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/" . basename(__FILE__) . ".pid";
    $pidTime = "/etc/artica-postfix/" . basename(__FILE__) . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "PidFile = {$pidfile}\n";
    }
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $timepid = $unix->PROCCESS_TIME_MIN($pid);
        system_admin_events("Other pid {$pid} running since {$timepid}mn", __FUNCTION__, __FILE__, __LINE__, "archive");
        die;
    }
    $TimeExec = $unix->file_time_min($pidTime);
    if ($TimeExec < 4) {
        return;
    }
    if (!is_dir("/var/spool/mail-rtt-backup")) {
        return;
    }
    @unlink($pidTime);
    @file_put_contents($pidTime, time());
    $pid = getmypid();
    file_put_contents($pidfile, $pid);
    $countDeFiles = 0;
    $t = time();
    if (!($handle = opendir("/var/spool/mail-rtt-backup"))) {
        @mkdir("/var/spool/mail-rtt-backup", 0755, true);
        die;
    }
    while (false !== ($filename = readdir($handle))) {
        if ($filename == ".") {
            continue;
        }
        if ($filename == "..") {
            continue;
        }
        $targetFile = "/var/spool/mail-rtt-backup/{$filename}";
        if ($GLOBALS["VERBOSE"]) {
            echo "Processing {$targetFile}\n";
        }
        if (archive_process($targetFile)) {
            if ($GLOBALS["VERBOSE"]) {
                echo "removing {$targetFile}\n";
            }
            @unlink($targetFile);
        }
        $countDeFiles++;
        if (system_is_overloaded(basename(__FILE__))) {
            $took = $unix->distanceOfTimeInWords($t, time());
            events("Fatal: Overloaded system {$GLOBALS["SYSTEM_INTERNAL_LOAD"]} after {$took} execution time processed {$countDeFiles} files ->  aborting task", __LINE__);
            die;
        }
    }
    ScanSize();
}
Example #2
0
    exit;
}
if (isset($_GET["changeinit-off"])) {
    change_init_off();
    exit;
}
if (isset($_GET["articaget"])) {
    articaget();
    exit;
}
if (isset($_GET["restore-site"])) {
    restore_site();
    exit;
}
if (isset($_GET["ScanSize"])) {
    ScanSize();
    exit;
}
if (isset($_GET["roudce-replic-host"])) {
    roundcube_replic_single();
    exit;
}
if (isset($_GET["display-config"])) {
    display_config();
    exit;
}
if (isset($_GET["reconfigure-webapp"])) {
    reconfigure_webapp();
    exit;
}
if (isset($_GET["query-logs"])) {