Ejemplo n.º 1
0
function MultiplesInstances_status()
{
    $unix = new unix();
    $users = new usersMenus();
    $sock = new sockets();
    if (!$users->MILTERGREYLIST_INSTALLED) {
        if ($GLOBALS["DEBUG"]) {
            echo __FUNCTION__ . " NoT installed\n";
        }
        return null;
    }
    $main = new maincf_multi($GLOBALS["hostname"], $GLOBALS["ou"]);
    $array_filters = unserialize(base64_decode($main->GET_BIGDATA("PluginsEnabled")));
    $enabled = $array_filters["APP_MILTERGREYLIST"];
    $pid_path = "/var/spool/postfix/var/run/milter-greylist/{$GLOBALS["hostname"]}/greylist.pid";
    if ($GLOBALS["DEBUG"]) {
        echo __FUNCTION__ . "{$GLOBALS["hostname"]} ({$GLOBALS["ou"]}) -> enabled={$enabled}\n";
    }
    $master_pid = trim(@file_get_contents($pid_path));
    if ($GLOBALS["DEBUG"]) {
        echo __FUNCTION__ . "master_pid={$master_pid}\n";
    }
    $l[] = "[MILTER_GREYLIST]";
    $l[] = "service_name=APP_MILTERGREYLIST";
    $l[] = "master_version=" . GetVersionOf("milter-greylist");
    $l[] = "service_cmd=mgreylist";
    $l[] = "service_disabled={$enabled}";
    $l[] = "pid_path={$pid_path}";
    $l[] = "remove_cmd=--milter-grelist-remove";
    if (!$unix->process_exists($master_pid)) {
        $l[] = "running=0";
        $l[] = "";
        echo implode("\n", $l);
        exit;
    }
    $l[] = "running=1";
    $l[] = GetMemoriesOf($master_pid);
    $l[] = "";
    if ($GLOBALS["DEBUG"]) {
        echo __FUNCTION__ . "FINISH\n";
    }
    echo implode("\n", $l);
}
Ejemplo n.º 2
0
function backuppc(){
		
	
	
	$binpath="/usr/share/backuppc/bin/BackupPC";
	if(!is_file("/usr/share/backuppc/bin/BackupPC")){return;}
	
	$EnableBackupPc=trim($GLOBALS["CLASS_SOCKETS"]->GET_INFO("EnableBackupPc"));
	if($EnableBackupPc==null){$EnableBackupPc=1;}
	
	$l[]="[APP_BACKUPPC]";
	$l[]="service_name=APP_BACKUPPC";
	$l[]="service_cmd=backuppc";	
	$l[]="master_version=".GetVersionOf("backuppc");
	$l[]="service_disabled=$EnableBackupPc";
	$l[]="family=storage";	

	
	if($EnableBackupPc==0){
		$l[]="running=0\ninstalled=1";$l[]="";
		return implode("\n",$l);
		return;
	}	
	
	$pid_path="/var/run/backuppc/BackupPC.pid";
	$master_pid=$GLOBALS["CLASS_UNIX"]->get_pid_from_file($pid_path);
	
	$l[]="watchdog_features=1";
	if(!$GLOBALS["CLASS_UNIX"]->process_exists($master_pid)){
		writelogs("$master_pid, process not exists",__FUNCTION__,__FILE__,__LINE__);
		$master_pid=$GLOBALS["CLASS_UNIX"]->PIDOF_PATTERN($binpath);
		writelogs("first, process not exists pidof return $master_pid",__FUNCTION__,__FILE__,__LINE__);
	}
	
	
	if(!$GLOBALS["CLASS_UNIX"]->process_exists($master_pid)){
		WATCHDOG("APP_BACKUPPC","backuppc");
		$l[]="running=0\ninstalled=1";$l[]="";
		return implode("\n",$l);
		return;
	}	

	$l[]="running=1";
	$l[]=GetMemoriesOf($master_pid);
	$l[]="";
	return implode("\n",$l);return;	
	
}