Ejemplo n.º 1
0
function CleanLOGSF()
{
    $unix = new unix();
    $Pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $PidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    // /etc/artica-postfix/pids/exec.clean.logs.php.squidClean.time
    if ($GLOBALS["VERBOSE"]) {
        echo "Pidfile: {$Pidfile}\n";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "PidTime: {$PidTime}\n";
    }
    $pid = $unix->get_pid_from_file($Pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Aborting Task already running pid {$pid} " . __FUNCTION__ . "()\n";
        }
        return;
    }
    @file_put_contents($Pidfile, getmypid());
    if (!$GLOBALS["VERBOSE"]) {
        $time = $unix->file_time_min($PidTime);
        if ($time < 15) {
            echo "Only each 15mn\n";
            die;
        }
        @unlink($PidTime);
        @file_put_contents($PidTime, time());
    }
    Clean_tmp_path(true);
    varlog();
    $squidbin = $unix->LOCATE_SQUID_BIN();
    if (is_file($squidbin)) {
        squidClean();
    }
    CleanLogs(true);
    logrotatelogs(true);
    Clean_tmp_path(true);
    artica_logs();
    nginx();
    sessions_clean();
    die;
}
Ejemplo n.º 2
0
function CleanLOGSF()
{
    $unix = new unix();
    $Pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $PidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    // /etc/artica-postfix/pids/exec.clean.logs.php.squidClean.time
    if ($GLOBALS["VERBOSE"]) {
        echo "Pidfile: {$Pidfile}\n";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "PidTime: {$PidTime}\n";
    }
    $pid = $unix->get_pid_from_file($Pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Aborting Task already running pid {$pid} " . __FUNCTION__ . "()\n";
        }
        return;
    }
    @file_put_contents($Pidfile, getmypid());
    if (!$GLOBALS["VERBOSE"]) {
        if (!$GLOBALS["FORCE"]) {
            $time = $unix->file_time_min($PidTime);
            echo "{$PidTime} = {$time}mn\n";
            if ($time < 15) {
                echo "Only each 15mn\n";
                die;
            }
            @unlink($PidTime);
            @file_put_contents($PidTime, time());
        }
    }
    Clean_tmp_path(true);
    varlog();
    $squidbin = $unix->LOCATE_SQUID_BIN();
    if (is_file($squidbin)) {
        squidClean();
    }
    CleanSuricataLogs();
    CleanKav4ProxyLogs();
    CleanLogs(true);
    Cleanbin();
    logrotatelogs(true);
    Clean_tmp_path(true);
    artica_logs();
    sessions_clean();
    ArticaMeta(true);
    if (is_dir("/var/log/influxdb")) {
        shell_exec("rm -rf /var/log/influxdb");
    }
    $dir = "/usr/share/artica-postfix/ressources/conf/upload/StatsApplianceLogs";
    if (is_dir($dir)) {
        $dirs = $unix->dirdir($dir);
        while (list($directory, $filename) = each($dirs)) {
            StatsApplianceLogs($directory);
        }
    }
    die;
}