include_once dirname(__FILE__) . "/framework/class.unix.inc"; include_once dirname(__FILE__) . "/framework/frame.class.inc"; cpulimit(); $_GET["LOGFILE"] = "/var/log/artica-postfix/dansguardian-logger.debug"; if (preg_match("#--verbose#", implode(" ", $argv))) { $GLOBALS["debug"] = true; $GLOBALS["VERBOSE"] = true; } if (preg_match("#--simulate#", implode(" ", $argv))) { $GLOBALS["SIMULATE"] = true; } if (posix_getuid() != 0) { die("Cannot be used in web server mode\n\n"); } if ($argv[1] == "--import") { include_tpl_file($argv[2], $argv[3]); die; } if ($argv[1] == "--sites-infos") { ParseSitesInfos(); die; } $pidfile = "/etc/artica-postfix/" . basename(__FILE__) . ".pid"; $oldpid = @file_get_contents($pidfile); $unix = new unix(); $GLOBALS["CLASS_UNIX"] = $unix; if ($unix->process_exists($oldpid)) { $time = $unix->PROCCESS_TIME_MIN($oldpid); events(basename(__FILE__) . ": Already executed {$oldpid} (since {$time}Mn).. aborting the process (line: Line: " . __LINE__ . ")"); events_tail("Already executed {$oldpid} (since {$time}Mn). aborting the process (line: Line: " . __LINE__ . ")"); if ($time > 120) {
<?php if(posix_getuid()<>0){die("Cannot be used in web server mode\n\n");} include_once(dirname(__FILE__)."/ressources/class.user.inc"); include_once(dirname(__FILE__)."/ressources/class.system.network.inc"); include_once(dirname(__FILE__)."/ressources/class.dansguardian.inc"); include_once(dirname(__FILE__)."/ressources/class.mysql.inc"); include_once(dirname(__FILE__)."/framework/class.unix.inc"); include_once(dirname(__FILE__)."/framework/frame.class.inc"); cpulimit(); $_GET["LOGFILE"]="/var/log/artica-postfix/dansguardian-logger.debug"; if(preg_match("#--verbose#",implode(" ",$argv))){$GLOBALS["debug"]=true;$GLOBALS["VERBOSE"]=true;} if(preg_match("#--simulate#",implode(" ",$argv))){$GLOBALS["SIMULATE"]=true;} if(posix_getuid()<>0){die("Cannot be used in web server mode\n\n");} if($argv[1]=="--import"){include_tpl_file($argv[2],$argv[3]);die();} if($argv[1]=="--sites-infos"){ParseSitesInfos();die();} $pidfile="/etc/artica-postfix/".basename(__FILE__).".pid"; $oldpid=@file_get_contents($pidfile); $unix=new unix(); $GLOBALS["CLASS_UNIX"]=$unix; if($unix->process_exists($oldpid)){ $time=$unix->PROCCESS_TIME_MIN($oldpid); events(basename(__FILE__).": Already executed $oldpid (since {$time}Mn).. aborting the process (line: ".__LINE__.")"); events_tail("Already executed $oldpid (since {$time}Mn). aborting the process (line: ".__LINE__.")"); if($time>120){ events(basename(__FILE__).": killing $oldpid (line: ".__LINE__.")"); shell_exec("/bin/kill -9 $oldpid"); }else{ die(); }