$GLOBALS["debug"] = true; $GLOBALS["VERBOSE"] = true; } $GLOBALS["EXEC_PID_FILE"] = "/etc/artica-postfix/" . basename(__FILE__) . ".daemon.pid"; $unix = new unix(); if ($unix->process_exists(@file_get_contents($GLOBALS["EXEC_PID_FILE"]))) { print "Starting......: artica-executor Already executed pid " . @file_get_contents($GLOBALS["EXEC_PID_FILE"]) . "...\n"; die; } FillMemory(); if ($argv[1] == '--mails-archives') { mailarchives(); die; } if ($argv[1] == '--stats-console') { stats_console(); die; } if ($argv[1] == '--all') { $unix = new unix(); $pidfile = "/etc/artica-postfix/" . basename(__FILE__) . ".pid"; $pidtime = "/etc/artica-postfix/" . basename(__FILE__) . ".time"; if ($unix->file_time_min($pidtime) < 3) { die; } $oldpid = @file_get_contents($pidfile); if ($unix->process_exists($oldpid, basename(__FILE__))) { events("Process {$oldpid} already in memory", "MAIN"); die; } @unlink($pidtime);
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'); include_once(dirname(__FILE__)."/framework/class.settings.inc"); if(preg_match("#--verbose#",implode(" ",$argv))){$GLOBALS["debug"]=true;$GLOBALS["VERBOSE"]=true;} $GLOBALS["EXEC_PID_FILE"]="/etc/artica-postfix/".basename(__FILE__).".daemon.pid"; $unix=new unix(); if($unix->process_exists(@file_get_contents($GLOBALS["EXEC_PID_FILE"]))){ print "Starting......: artica-executor Already executed pid ". @file_get_contents($GLOBALS["EXEC_PID_FILE"])."...\n"; die(); } FillMemory(); if($argv[1]=='--mails-archives'){mailarchives();die();} if($argv[1]=='--stats-console'){stats_console();die();} if($argv[1]=='--all'){launch_all_status();die();} if(preg_match("#--(.+)#", $argv[1],$re)){if(function_exists($re[1])){events("Execute {$re[1]}() -> \"{$argv[1]}\"" ,"MAIN");call_user_func($re[1]);die();}} if($argv[1]<>null){events("Unable to understand ". implode(" ",$argv),"MAIN");die();} $nofork=false; if(!function_exists("pcntl_signal")){$nofork=true;} if($GLOBALS["TOTAL_MEMORY_MB"]<400){$nofork=true;} if($nofork){ print "Starting......: artica-status pcntl_fork module not loaded !\n"; $pidfile="/etc/artica-postfix/".basename(__FILE__).".pid";