예제 #1
0
			events("Counter ($count) is up to 120 -> Launch all status...",__FUNCTION__,__LINE__);
			try {launch_all_status(true);} catch (Exception $e) {writelogs("Fatal while running function launch_all_status $e",__FUNCTION__,__FILE__,__LINE__);}
			continue;
		}
		
		if($reload){
			$reload=false;
			events("reload daemon ($count seconds)",__FUNCTION__,__LINE__);
			$GLOBALS["CLASS_SOCKETS"]=new sockets();
			$GLOBALS["CLASS_USERS"]=new settings_inc();
			$GLOBALS["CLASS_UNIX"]=new unix();
			$GLOBALS["TIME_CLASS"]=time();
			$GLOBALS["ArticaWatchDogList"]=unserialize(base64_decode($GLOBALS["CLASS_SOCKETS"]->GET_INFO("ArticaWatchDogList")));
			unset($GLOBALS["GetVersionOf"]);	
			if(!is_file("/usr/share/artica-postfix/ressources/logs/global.status.ini")){
				launch_all_status(true);
				$count=0;
			}
			$GLOBALS["AMAVIS_WATCHDOG"]=unserialize(@file_get_contents("/etc/artica-postfix/amavis.watchdog.cache"));
			
				
		}
		
		include_once("ressources/class.os.system.tools.inc");
		$os=new os_system();
		$GLOBALS["MEMORY_INSTALLED"]=$os->memory();
		$os=null;
		$GLOBALS["CLASS_SOCKETS"]=null;
		$GLOBALS["CLASS_USERS"]=null;
		$GLOBALS["CLASS_UNIX"]=null;	
	}
예제 #2
0
    }
}
$childpid = posix_getpid();
@file_put_contents($GLOBALS["EXEC_PID_FILE"], $childpid);
FillMemory();
$renice_bin = $unix->find_program("renice");
if (is_file($renice_bin)) {
    events("{$renice_bin} 19 {$childpid}", __FUNCTION__, __LINE__);
    shell_exec("{$renice_bin} 19 {$childpid} &");
}
$GLOBALS["CLASS_SOCKETS"] = new sockets();
$GLOBALS["CLASS_USERS"] = new settings_inc();
$GLOBALS["CLASS_UNIX"] = new unix();
while ($stop_server == false) {
    sleep(3);
    launch_all_status();
    if ($reload) {
        $reload = false;
        events("reload daemon", __FUNCTION__, __LINE__);
        FillMemory();
    }
}
function sig_handler($signo)
{
    global $stop_server;
    global $reload;
    switch ($signo) {
        case SIGTERM:
            $stop_server = true;
            break;
        case 1:
예제 #3
0
function launch_all_status_cmdline()
{
    if ($GLOBALS["VERBOSE"]) {
        echo "launch_all_status_cmdline()\n";
    }
    $pids = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $CacheFileTime = "/usr/share/artica-postfix/ressources/logs/global.status.ini";
    $unix = new unix();
    $pid = $unix->get_pid_from_file($pids);
    if ($unix->process_exists($pid)) {
        return;
    }
    @file_put_contents($pids, getmypid());
    $time = $unix->file_time_min($CacheFileTime);
    if (!$GLOBALS["VERBOSE"]) {
        if ($time < 2) {
            events("{$time}mn, need at least 2mn", __FUNCTION__, __LINE__);
            return;
        }
    }
    @unlink($CacheFileTime);
    @file_put_contents($CacheFileTime, "\n");
    events("-> launch_all_status()", __FUNCTION__, __LINE__);
    launch_all_status();
}