Example #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;
}
Example #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;
}
Example #3
0
    die("Cannot be used in web server mode\n\n");
}
include_once dirname(__FILE__) . '/ressources/class.templates.inc';
include_once dirname(__FILE__) . '/ressources/class.ini.inc';
include_once dirname(__FILE__) . '/framework/class.unix.inc';
include_once dirname(__FILE__) . '/framework/frame.class.inc';
include_once dirname(__FILE__) . '/ressources/class.os.system.inc';
include_once dirname(__FILE__) . '/ressources/class.system.network.inc';
if (preg_match("#--verbose#", implode(" ", $argv))) {
    $GLOBALS["VERBOSE"] = true;
}
if (preg_match("#--force#", implode(" ", $argv))) {
    $GLOBALS["FORCE"] = true;
}
if ($argv[1] == '--clean-tmp') {
    CleanLogs();
    die;
}
if (systemMaxOverloaded()) {
    writelogs("This system is too many overloaded, die()", __FUNCTION__, __FILE__, __LINE__);
    die;
}
function init()
{
    $sock = new sockets();
    $ArticaMaxLogsSize = $sock->GET_PERFS("ArticaMaxLogsSize");
    if ($ArticaMaxLogsSize < 1) {
        $ArticaMaxLogsSize = 500;
    }
    $ArticaMaxLogsSize = $ArticaMaxLogsSize * 1000;
    $GLOBALS["ArticaMaxLogsSize"] = $ArticaMaxLogsSize;
Example #4
0
<?php
if(posix_getuid()<>0){die("Cannot be used in web server mode\n\n");}
include_once(dirname(__FILE__).'/ressources/class.templates.inc');
include_once(dirname(__FILE__).'/ressources/class.ini.inc');
include_once(dirname(__FILE__).'/framework/class.unix.inc');
include_once(dirname(__FILE__).'/framework/frame.class.inc');
include_once(dirname(__FILE__).'/ressources/class.os.system.inc');
include_once(dirname(__FILE__).'/ressources/class.system.network.inc');


if(preg_match("#--verbose#",implode(" ",$argv))){$GLOBALS["VERBOSE"]=true;}
if(preg_match("#--force#",implode(" ",$argv))){$GLOBALS["FORCE"]=true;}

if($argv[1]=='--clean-tmp'){CleanLogs();die();}
if($argv[1]=='--clean-sessions'){sessions_clean();die();}
if($argv[1]=='--clean-install'){CleanOldInstall();die();}
if($argv[1]=='--paths-status'){PathsStatus();die();}
if($argv[1]=='--maillog'){maillog();die();}



if(systemMaxOverloaded()){
	writelogs("This system is too many overloaded, die()",__FUNCTION__,__FILE__,__LINE__);
	die();
}

function init(){
	$sock=new sockets();
	$ArticaMaxLogsSize=$sock->GET_PERFS("ArticaMaxLogsSize");
	if($ArticaMaxLogsSize<1){$ArticaMaxLogsSize=500;}
	$ArticaMaxLogsSize=$ArticaMaxLogsSize*1000;