include_once dirname(__FILE__) . '/ressources/class.os.system.inc'; include_once dirname(__FILE__) . '/ressources/class.squid.tail.inc'; include_once dirname(__FILE__) . "/framework/frame.class.inc"; include_once dirname(__FILE__) . '/ressources/whois/whois.main.php'; $sock = new sockets(); $sock->SQUID_DISABLE_STATS_DIE(); if ($argv[1] == "--main-table") { main_table(); exit; } if ($argv[1] == "--now") { UsersSizeByHour(); ParseQueue(); } UsersSizeByHour(); ParseQueue(); UserRTT_SIZE_DAY(); UserSizeRTT_oldfiles(); main_table(); function UsersSizeByHour() { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid"; $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time"; $pid = @file_get_contents($pidfile); if (systemMaxOverloaded()) { events("UsersSizeByHour:: systemMaxOverloaded {$GLOBALS["SYSTEM_INTERNAL_LOAD"]} !!! -> DIE", __LINE__); return; } $unix = new unix(); $mypid = getmypid(); if ($unix->process_exists($pid, basename(__FILE__))) {
$pid = getmypid(); if (file_exists('/etc/artica-postfix/croned.1/robot.whitelist.pid')) { $currentpid = trim(@file_get_contents('/etc/artica-postfix/croned.1/robot.whitelist.pid')); echo date('Y-m-d h:i:s') . " NewPID PID: {$pid}\n"; echo date('Y-m-d h:i:s') . " Current PID: {$currentpid}\n"; if ($currentpid != $pid) { if (is_dir('/proc/' . $currentpid)) { die(date('Y-m-d h:i:s') . " Already instance executed"); } else { echo date('Y-m-d h:i:s') . " {$currentpid} is not executed continue...\n"; } } } @mkdir("/etc/artica-postfix/croned.1"); file_put_contents('/etc/artica-postfix/croned.1/robot.whitelist.pid', $pid); $count = ParseQueue(); if ($count > 0) { write_syslog("Compile white & black lists", __FILE__); system('/usr/share/artica-postfix/bin/artica-ldap --wbld >/dev/null 2>&1'); } die; function ParseQueue() { $array = DirList('/var/mail/artica-wbl'); if (!is_array($array)) { return null; } $ldap = new clladp(); while (list($key, $filename) = each($array)) { $continue = true; $noscan = false;