示例#1
0
function launch_all_status($force = false)
{
    xLoadAvg();
    if (!is_file("/usr/share/artica-postfix/ressources/settings.inc")) {
        shell_exec("/usr/share/artica-postfix/bin/process1 --force");
    }
    $trace = debug_backtrace();
    if (isset($trace[1])) {
        $called = " called by " . basename($trace[1]["file"]) . " {$trace[1]["function"]}() line {$trace[1]["line"]}";
        events("{$called}", __FUNCTION__, __LINE__);
    }
    CheckCallable();
    if (!is_file("/usr/share/artica-postfix/ressources/logs/global.versions.conf")) {
        events("-> artica-install --write-version", __FUNCTION__, __LINE__);
        $GLOBALS["CLASS_UNIX"]->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --write-versions");
    } else {
        $filetime = file_time_min("/usr/share/artica-postfix/ressources/logs/global.versions.conf");
        events("global.versions.conf={$filetime}mn ", __FUNCTION__, __LINE__);
        if ($filetime > 60) {
            events("global.versions.conf \"{$filetime}\"mn", __FUNCTION__, __LINE__);
            @unlink("/usr/share/artica-postfix/ressources/logs/global.versions.conf");
            $GLOBALS["CLASS_UNIX"]->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --write-versions");
        }
    }
    @unlink($GLOBALS["MY-POINTER"]);
    @file_put_contents($GLOBALS["MY-POINTER"], time());
    $authtailftime = "/etc/artica-postfix/pids/auth-tail.time";
    $unix = new unix();
    $timefile = $unix->file_time_min($authtailftime);
    events("/etc/artica-postfix/pids/auth-tail.time -> {$timefile}Mn", __FUNCTION__, __LINE__);
    if ($timefile > 15) {
        @unlink($timefile);
        @file_put_contents($authtailftime, time());
        $cmd = trim("{$GLOBALS["nohup"]} /etc/init.d/artica-postfix restart auth-logger >/dev/null 2>&1 &");
        events($cmd);
        shell_exec($cmd);
    }
    $globalStatusIniTime = $unix->file_time_min("/usr/share/artica-postfix/ressources/logs/global.status.ini");
    if ($GLOBALS["RUN_AS_DAEMON"]) {
        if ($globalStatusIniTime < 2) {
            return;
        }
    }
    events("**************** START ALL STATUS ****************");
    events_start("start processing");
    $t1 = time();
    $functions = array("squid_master_status", "c_icap_master_status", "kav4Proxy_status", "dansguardian_master_status", "wpa_supplicant", "fetchmail", "milter_greylist", "framework", "pdns_server", "pdns_recursor", "cyrus_imap", "mysql_server", "mysql_mgmt", "mysql_replica", "openldap", "saslauthd", "syslogger", "squid_tail", "amavis", "amavis_milter", "boa", "lighttpd", "fcron1", "fcron2", "clamd", "clamscan", "clammilter", "freshclam", "retranslator_httpd", "spamassassin_milter", "spamassassin", "postfix", "postfix_logger", "mailman", "kas3_milter", "kas3_ap", "smbd", "nmbd", "winbindd", "scanned_only", "roundcube", "cups", "apache-groupware", "apache_groupware", "gdm", "console-kit", "xfce", "vmtools", "hamachi", "artica_notifier", "dhcpd_server", "pure_ftpd", "mldonkey", "policyd_weight", "backuppc", "kav4fs", "kav4fsavs", "apache_ocsweb", "web_download", "ocs_agent", "openssh", "gluster", "auditd", "squidguardweb", "opendkim", "ufdbguardd", "squidguard_logger", "milter_dkim", "dropbox", "artica_policy", "virtualbox_webserv", "tftpd", "dhcpd_server", "crossroads", "artica_status", "artica_executor", "artica_background", "bandwith", "pptpd", "pptp_clients", "apt_mirror", "squid_clamav_tail", "ddclient", "cluebringer", "apachesrc", "zarafa_web", "zarafa_ical", "zarafa_dagent", "zarafa_indexer", "zarafa_monitor", "zarafa_gateway", "zarafa_spooler", "zarafa_server", "assp", "openvpn", "vboxguest", "sabnzbdplus", "SwapWatchdog", "artica_meta_scheduler", "OpenVPNClientsStatus", "stunnel", "meta_checks", "zarafa_licensed", "CheckCurl", "ufdbguardd_tail", "vnstat", "NetAdsWatchdog", "munin", "autofs", "greyhole", "dnsmasq", "iscsi", "watchdog_yorel", "postfwd2", "vps_servers", "smartd", "crossroads_multiple", "auth_tail", "greyhole_watchdog", "greensql", "nscd", "tomcat", "openemm", "openemm_sendmail", "cgroups", "ntpd_server", "arpd", "ps_mem");
    $data1 = $GLOBALS["TIME_CLASS"];
    $data2 = time();
    $difference = $data2 - $data1;
    $min = round($difference / 60);
    if ($min > 9) {
        events("reloading classes...", __FUNCTION__, __LINE__);
        $GLOBALS["TIME_CLASS"] = time();
        $GLOBALS["CLASS_SOCKETS"] = new sockets();
        $GLOBALS["CLASS_USERS"] = new settings_inc();
        $GLOBALS["CLASS_UNIX"] = new unix();
    }
    $took = $unix->distanceOfTimeInWords($t1, time());
    events_start("end processing {$took}");
    events("running " . count($functions) . " functions  {$mem}MB in memory", __FUNCTION__, __LINE__);
    while (list($num, $func) = each($functions)) {
        if (function_exists($func)) {
            $mem = round(memory_get_usage() / 1024 / 1000, 2);
            if (!$force) {
                if (system_is_overloaded()) {
                    events("running function \"{$func}\" {$mem}MB in memory", __FUNCTION__, __LINE__);
                    events("System is overloaded: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, pause 10 seconds", __FUNCTION__, __LINE__);
                    AmavisWatchdog();
                    greyhole_watchdog();
                    sleep(10);
                    return;
                } else {
                    if (systemMaxOverloaded()) {
                        events("running function \"{$func}\" {$mem}MB in memory", __FUNCTION__, __LINE__);
                        events("System is very overloaded {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, stop", __FUNCTION__, __LINE__);
                        AmavisWatchdog();
                        greyhole_watchdog();
                        return;
                    }
                }
            }
            try {
                $results = call_user_func($func);
            } catch (Exception $e) {
                writelogs("Fatal while running function {$func} ({$e})", __FUNCTION__, __FILE__, __LINE__);
            }
            if (trim($results) != null) {
                $conf[] = $results;
                usleep(5000);
            }
        }
    }
    events("running " . count($functions) . " functions  DONE {$mem}MB in memory", __FUNCTION__, __LINE__);
    @unlink("/usr/share/artica-postfix/ressources/logs/global.status.ini");
    file_put_contents("/usr/share/artica-postfix/ressources/logs/global.status.ini", @implode("\n", $conf));
    @chmod(770, "/usr/share/artica-postfix/ressources/logs/global.status.ini");
    @file_put_contents("/etc/artica-postfix/cache.global.status", @implode("\n", $conf));
    events("creating status done " . count($conf) . " lines....", __FUNCTION__, __LINE__);
    $cmd = trim("{$GLOBALS["nohup"]} {$GLOBALS["NICE"]} {$GLOBALS["PHP5"]} " . dirname(__FILE__) . "/exec.parse-orders.php --manual >/dev/null 2>&1 &");
    events($cmd);
    shell_exec($cmd);
}
示例#2
0
function launch_all_status($force=false){
	
	xLoadAvg();
	
	$trace=debug_backtrace();if(isset($trace[1])){$called=" called by ". basename($trace[1]["file"])." {$trace[1]["function"]}() line {$trace[1]["line"]}";events("$called",__FUNCTION__,__LINE__);}	

	CheckCallable();
	if(!is_file("/usr/share/artica-postfix/ressources/logs/global.versions.conf")){
		events("-> artica-install --write-version",__FUNCTION__,__LINE__);
		$GLOBALS["CLASS_UNIX"]->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --write-versions");
	}else{
		$filetime=file_time_min("/usr/share/artica-postfix/ressources/logs/global.versions.conf");
		events("global.versions.conf={$filetime}mn ",__FUNCTION__,__LINE__);
		if($filetime>60){
			events("global.versions.conf \"$filetime\"mn",__FUNCTION__,__LINE__);
			@unlink("/usr/share/artica-postfix/ressources/logs/global.versions.conf");
			$GLOBALS["CLASS_UNIX"]->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --write-versions");
		}
	}
	
	@unlink($GLOBALS["MY-POINTER"]);
	@file_put_contents($GLOBALS["MY-POINTER"],time());
	
	$functions=array("squid_master_status","c_icap_master_status","kav4Proxy_status","dansguardian_master_status","wpa_supplicant","fetchmail","milter_greylist",
	"framework","pdns_server","pdns_recursor","cyrus_imap","mysql_server","mysql_mgmt","mysql_replica","openldap","saslauthd","syslogger","squid_tail","amavis",
	"amavis_milter","boa","lighttpd","fcron1","fcron2","clamd","clamscan","clammilter","freshclam","retranslator_httpd","spamassassin_milter","spamassassin",
	"postfix","postfix_logger","mailman","kas3_milter","kas3_ap","smbd","nmbd","winbindd","scanned_only","roundcube","cups","apache-groupware","apache_groupware",
	"gdm","console-kit","xfce","vmtools","hamachi","artica_notifier","dhcpd_server","pure_ftpd","mldonkey","policyd_weight","backuppc","kav4fs","kav4fsavs",
	"apache_ocsweb","web_download","ocs_agent","openssh","gluster","auditd","squidguardweb","opendkim","ufdbguardd","squidguard_logger","milter_dkim","dropbox",
	"artica_policy","virtualbox_webserv","tftpd","dhcpd_server","crossroads","artica_status","artica_executor","artica_background","bandwith",
	 "pptpd","pptp_clients","apt_mirror","squid_clamav_tail","ddclient","cluebringer","apachesrc","zarafa_web","zarafa_ical","zarafa_dagent","zarafa_indexer",
	"zarafa_monitor","zarafa_gateway","zarafa_spooler","zarafa_server","assp","openvpn","vboxguest","sabnzbdplus","SwapWatchdog","artica_meta_scheduler",
	"OpenVPNClientsStatus","stunnel","meta_checks","zarafa_licensed","CheckCurl","ufdbguardd_tail","vnstat","NetAdsWatchdog","munin","autofs","greyhole",
	"dnsmasq","iscsi","watchdog_yorel","postfwd2","vps_servers","smartd","crossroads_multiple","auth_tail","greyhole_watchdog","greensql"
	);
	$data1=$GLOBALS["TIME_CLASS"];
	$data2 = time();
	$difference = ($data2 - $data1); 	 
	$min=round($difference/60);	
	if($min>9){
		events("reloading classes...",__FUNCTION__,__LINE__);
		$GLOBALS["TIME_CLASS"]=time();
		$GLOBALS["CLASS_SOCKETS"]=new sockets();
		$GLOBALS["CLASS_USERS"]=new settings_inc();
		$GLOBALS["CLASS_UNIX"]=new unix();		
	} 
	
	
	
	while (list ($num, $func) = each ($functions) ){
		if(function_exists($func)){
			$mem=round(((memory_get_usage()/1024)/1000),2);
			events("running function \"$func\" {$mem}MB in memory",__FUNCTION__,__LINE__);
			if(!$force){
				if(system_is_overloaded()){
					events("System is overloaded: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, pause 2 seconds",__FUNCTION__,__LINE__);
					AmavisWatchdog();
					greyhole_watchdog();
					sleep(2);
					return;
				}else{
					if(systemMaxOverloaded()){
					events("System is very overloaded {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, pause 5  seconds",__FUNCTION__,__LINE__);
					AmavisWatchdog();
					greyhole_watchdog();
					sleep(5);
					return;
					}
				}
			}
			
			try {
				$results=call_user_func($func);
			} catch (Exception $e) {
				writelogs("Fatal while running function $func ($e)",__FUNCTION__,__FILE__,__LINE__);
			}
			
			if(trim($results)<>null){$conf[]=$results;}
		}
	}
	
@unlink("/usr/share/artica-postfix/ressources/logs/global.status.ini");
file_put_contents("/usr/share/artica-postfix/ressources/logs/global.status.ini",@implode("\n",$conf));
@chmod(770,"/usr/share/artica-postfix/ressources/logs/global.status.ini");
@file_put_contents("/etc/artica-postfix/cache.global.status",@implode("\n",$conf));	
events("creating status done ". count($conf)." lines....",__FUNCTION__,__LINE__);
}
示例#3
0
function launch_all_status($force = false)
{
    $conf = array();
    $CacheFileTime = "/usr/share/artica-postfix/ressources/logs/global.status.ini";
    mkdir_test("/usr/share/artica-postfix/ressources/logs", 0755, true);
    if (!is_file("/usr/share/artica-postfix/ressources/logs/php.log")) {
        @touch("/usr/share/artica-postfix/ressources/logs/php.log");
    }
    events("launch_all_status() -> xLoadAvg().., started", __FUNCTION__, __LINE__);
    xLoadAvg();
    ChecksRoutes();
    events("global.status.ini OK next step...", __FUNCTION__, __LINE__);
    $trace = debug_backtrace();
    if (isset($trace[1])) {
        $called = " called by " . basename($trace[1]["file"]) . " {$trace[1]["function"]}() line {$trace[1]["line"]}";
        events("{$called}", __FUNCTION__, __LINE__);
    }
    events("global.status.ini OK CheckCallable()", __FUNCTION__, __LINE__);
    CheckCallable();
    if (!system_is_overloaded()) {
        $GLOBALS["CLASS_UNIX"]->Process1();
        if (!is_file("/usr/share/artica-postfix/ressources/logs/global.versions.conf")) {
            events("-> artica-install --write-version", __FUNCTION__, __LINE__);
            $GLOBALS["CLASS_UNIX"]->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --write-versions");
        } else {
            $filetime = file_time_min("/usr/share/artica-postfix/ressources/logs/global.versions.conf");
            events("global.versions.conf={$filetime}mn ", __FUNCTION__, __LINE__);
            if ($filetime > 60) {
                events("global.versions.conf \"{$filetime}\"mn", __FUNCTION__, __LINE__);
                @unlink("/usr/share/artica-postfix/ressources/logs/global.versions.conf");
                $GLOBALS["CLASS_UNIX"]->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --write-versions");
            }
        }
    }
    @unlink($GLOBALS["MY-POINTER"]);
    @file_put_contents($GLOBALS["MY-POINTER"], time());
    $authtailftime = "/etc/artica-postfix/pids/auth-tail.time";
    $unix = new unix();
    $timefile = $unix->file_time_min($authtailftime);
    events("/etc/artica-postfix/pids/auth-tail.time -> {$timefile}Mn", __FUNCTION__, __LINE__);
    if ($timefile > 15) {
        @unlink($timefile);
        @file_put_contents($authtailftime, time());
        $cmd = trim("{$GLOBALS["nohup"]} /etc/init.d/artica-postfix restart auth-logger >/dev/null 2>&1 &");
        events($cmd);
        shell_exec2($cmd);
    }
    $TimeF = "/etc/artica-postfix/pids/exec.system.last.php.xstart.php.time";
    $timefile = $unix->file_time_min($TimeF);
    if ($timefile > 60) {
        $cmd = trim("{$GLOBALS["nohup"]} {$GLOBALS["NICE"]} {$GLOBALS["PHP5"]} " . dirname(__FILE__) . "/exec.system.last.php >/dev/null 2>&1 &");
        events($cmd);
        shell_exec2($cmd);
    }
    @unlink($CacheFileTime);
    @file_put_contents($CacheFileTime, time());
    if (is_dir("/etc/resolvconf")) {
        if (!is_file("/etc/resolvconf/resolv.conf.d/base")) {
            $cmd = trim("{$GLOBALS["nohup"]} {$GLOBALS["NICE"]} {$GLOBALS["PHP5"]} " . dirname(__FILE__) . "/exec.virtuals-ip.php --resolvconf >/dev/null 2>&1 &");
            events($cmd);
            shell_exec2($cmd);
        }
    }
    events("**************** START ALL STATUS ****************");
    events("global.status.ini start processing", __FUNCTION__, __LINE__);
    events_syslog("start processing");
    $t1 = time();
    $GLOBALS["CLASS_UNIX"]->chmod_func(0755, "/etc/artica-postfix/settings/Daemons/*");
    $functions = array("Default_values", "load_stats", "fail2ban", "unifi_mongodb", "unifi", "Popuplate_cron", "squid_dashboard_statistics", "philesight", "cron", "transmission_daemon", "disks_monitor", "InfluxDB", "CleanLogs", "monit", "kav4Proxy_status", "dansguardian_master_status", "wpa_supplicant", "fetchmail", "milter_greylist", "irqbalance", "framework", "pdns_server", "pdns_recursor", "cyrus_imap", "mysql_server", "mysql_mgmt", "mysql_replica", "openldap", "saslauthd", "syslogger", "amavis", "amavis_milter", "boa", "lighttpd", "clamd", "clamscan", "clammilter", "freshclam", "retranslator_httpd", "spamassassin_milter", "spamassassin", "postfix", "postfix_logger", "mailman", "kas3_milter", "kas3_ap", "rpcbind", "smbd", "nmbd", "winbindd", "scanned_only", "roundcube", "cups", "apache_groupware", "gdm", "xfce", "vmtools", "hamachi", "artica_notifier", "dhcpd_server", "pure_ftpd", "mldonkey", "backuppc", "kav4fs", "kav4fsavs", "apache_ocsweb", "ocs_agent", "openssh", "gluster", "auditd", "milter_dkim", "dropbox", "artica_policy", "virtualbox_webserv", "tftpd", "dhcpd_server", "crossroads", "artica_status", "bandwith", "pptpd", "pptp_clients", "apt_mirror", "ddclient", "cluebringer", "apachesrc", "zarafa_server2", "assp", "openvpn", "vboxguest", "sabnzbdplus", "MemorySync", "MemoryWatchdog", "SwapWatchdog", "artica_meta_scheduler", "OpenVPNClientsStatus", "stunnel", "meta_checks", "avahi_daemon", "CheckCurl", "vnstat", "NetAdsWatchdog", "munin", "autofs", "greyhole", "dnsmasq", "iscsi", "watchdog_yorel", "netatalk", "postfwd2", "vps_servers", "smartd", "crossroads_multiple", "auth_tail", "greyhole_watchdog", "greensql", "nscd", "tomcat", "openemm", "openemm_sendmail", "cgroups", "ntpd_server", "arpd", "ps_mem", "ipsec", "yaffas", "ifconfig_network", "testingrrd", "zarafa_multi", "memcached", "UpdateUtilityHTTP", "udevd_daemon", "dbus_daemon", "ejabberd", "pymsnt", "arkwsd", "arkeiad", "haproxy", "klms_status", "klmsdb_status", "klms_milter", "CleanLogs", "mimedefangmx", "mimedefang", "zarafa_search", "snort", "amavisdb", "nginx", "nginx_db", "checksyslog", "freeradius", "maillog_watchdog", "arp_spoof", "caches_pages", "php_fpm", "php_fcgi", "CleanCloudCatz", "syslog_db", "roundcube_db", "Scheduler", "exim4", "snmpd", "ntopng", "redis_server", "bwm_ng", "XMail", "conntrackd", "iptables", "rdpproxy_authhook", "rdpproxy", "vde_all", "iptables_tasks", "l7filter", "syncthing", "killstrangeprocesses");
    ToSyslog("launch_all_status(): " . count($functions));
    $postfix_functions = array();
    $postconf = $GLOBALS["CLASS_UNIX"]->find_program("postconf");
    ToSyslog("launch_all_status(): postconf: {$postconf}");
    if (is_file($postconf)) {
        include_once '/usr/share/artica-postfix/ressources/class.status.postfix.inc';
        $postfix_functions = postfix_increment_func(array());
        if ($GLOBALS["ZARAFA_INSTALLED"]) {
            include_once '/usr/share/artica-postfix/ressources/class.status.zarafa.inc';
            $postfix_functions = zarafa_increment_func($postfix_functions);
        }
    }
    if ($GLOBALS["SQUID_INSTALLED"]) {
        include_once '/usr/share/artica-postfix/ressources/class.status.squid.inc';
        $squid_functions = squid_increment_func(array());
    }
    ToSyslog("launch_all_status(): " . count($functions));
    $stats = new status_hardware();
    $data1 = $GLOBALS["TIME_CLASS"];
    $data2 = time();
    $difference = $data2 - $data1;
    $min = round($difference / 60);
    if ($min > 9) {
        events("reloading classes...", __FUNCTION__, __LINE__);
        $GLOBALS["TIME_CLASS"] = time();
        $GLOBALS["CLASS_SOCKETS"] = new sockets();
        $GLOBALS["CLASS_USERS"] = new settings_inc();
        $GLOBALS["CLASS_UNIX"] = new unix();
    }
    if (!isset($GLOBALS["CLASS_UNIX"])) {
        $GLOBALS["CLASS_SOCKETS"] = new sockets();
        $GLOBALS["CLASS_USERS"] = new settings_inc();
        $GLOBALS["CLASS_UNIX"] = new unix();
    }
    $AllFunctionCount = count($functions);
    events("running {$AllFunctionCount} functions ", __FUNCTION__, __LINE__);
    if ($force) {
        events("running function in FORCE MODE !", __FUNCTION__, __LINE__);
    }
    $max = count($functions);
    $c = 0;
    $TEX = time();
    while (list($num, $func) = each($functions)) {
        $c++;
        $mem = round(memory_get_usage() / 1024 / 1000, 2);
        if ($GLOBALS["VERBOSE"]) {
            echo "*****\n{$func} {$c}/{$max}\n*****\n";
        }
        if (!function_exists($func)) {
            continue;
        }
        events("Running {$c}/{$max} {$func}() function {$mem}MB", __FUNCTION__, __LINE__);
        if (is_file("/etc/artica-postfix/ARTICA_STATUS_RELOAD")) {
            ToSyslog("Reloading settings and libraries...");
            Reload();
        }
        if (!$force) {
            if (system_is_overloaded(basename(__FILE__))) {
                events("System is overloaded: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, aborting", __FUNCTION__, __LINE__);
                ToSyslog("System is overloaded: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, aborting");
                AmavisWatchdog();
                greyhole_watchdog();
                break;
            }
        }
        try {
            if ($GLOBALS["VERBOSE"]) {
                echo "***** {$c}/{$max} {$func} *****\n";
            }
            $results = call_user_func($func);
            $GLOBALS["LAST_FUNCTION_USED"] = "{$func}()";
        } catch (Exception $e) {
            ToSyslog("Fatal while running function {$func} ({$e})");
        }
        if (trim($results) != null) {
            $conf[] = $results;
        }
    }
    events("Postfix functions: " . count($postfix_functions) . " functions", __FUNCTION__, __LINE__);
    if (count($postfix_functions) > 0) {
        $c = 0;
        $max = count($postfix_functions);
        while (list($num, $func) = each($postfix_functions)) {
            $c++;
            $mem = round(memory_get_usage() / 1024 / 1000, 2);
            if ($GLOBALS["VERBOSE"]) {
                echo "*****\npostfix_functions {$func} {$c}/{$max}\n*****\n";
            }
            events("Postfix functions: Running {$c}/{$max} {$func}() function {$mem}MB", __FUNCTION__, __LINE__);
            if (!function_exists($func)) {
                continue;
            }
            if (!$force) {
                if (system_is_overloaded(basename(__FILE__))) {
                    events("System is overloaded: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, aborting", __FUNCTION__, __LINE__);
                    ToSyslog("System is overloaded: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, aborting");
                    AmavisWatchdog();
                    greyhole_watchdog();
                    break;
                }
            }
            try {
                $results = call_user_func($func);
            } catch (Exception $e) {
                ToSyslog("Fatal while running function {$func} ({$e})");
            }
            if (trim($results) != null) {
                $conf[] = $results;
            }
        }
    }
    events("Squid functions: " . count($squid_functions) . " functions", __FUNCTION__, __LINE__);
    if (count($squid_functions) > 0) {
        $c = 0;
        $max = count($squid_functions);
        while (list($num, $func) = each($squid_functions)) {
            $mem = round(memory_get_usage() / 1024 / 1000, 2);
            if ($GLOBALS["VERBOSE"]) {
                echo "*****\n{$func} {$c}/{$max}\n*****\n";
            }
            if (!function_exists($func)) {
                events("Squid functions: {$func}() No such function", __FUNCTION__, __LINE__);
                continue;
            }
            events("Squid functions: Running {$c}/{$max} {$func}() function {$mem}MB", __FUNCTION__, __LINE__);
            _statussquid("Launch {$func}(): {$mem}MB in memory");
            $c++;
            try {
                $results = call_user_func($func);
            } catch (Exception $e) {
                events("Fatal while running function {$func} ({$e})", __FUNCTION__, __LINE__);
                _statussquid("Fatal while running function {$func} ({$e})");
            }
            if (trim($results) != null) {
                $conf[] = $results;
            }
        }
    }
    $p = new processes_php();
    $p->MemoryInstances();
    $p = null;
    $TOOK = $GLOBALS["CLASS_UNIX"]->distanceOfTimeInWords($TEX, time(), true);
    $mem = round(memory_get_usage() / 1024 / 1000, 2);
    $percent_free = $GLOBALS["CLASS_UNIX"]->GetMemFreePourc();
    ToSyslog("Executed " . count($functions) . " functions in {$TOOK} MemFree {$percent_free}% Used memory: {$mem}MB");
    @unlink("/usr/share/artica-postfix/ressources/logs/global.status.ini");
    file_put_contents("/usr/share/artica-postfix/ressources/logs/global.status.ini", @implode("\n", $conf));
    @chmod("/usr/share/artica-postfix/ressources/logs/global.status.ini", 0777);
    @file_put_contents("/etc/artica-postfix/cache.global.status", @implode("\n", $conf));
    events("creating status done " . count($conf) . " lines....", __FUNCTION__, __LINE__);
    $sock = new sockets();
    $WizardSavedSettingsSend = $sock->GET_INFO("WizardSavedSettingsSend");
    if (!is_numeric($WizardSavedSettingsSend)) {
        $WizardSavedSettingsSend = 0;
    }
    if ($WizardSavedSettingsSend == 0) {
        $cmd = trim("{$GLOBALS["nohup"]} {$GLOBALS["NICE"]} {$GLOBALS["PHP5"]} " . dirname(__FILE__) . "/exec.web-community-filter.php --register >/dev/null 2>&1 &");
        shell_exec2($cmd);
    }
    if (!is_file("/usr/share/artica-postfix/ressources/settings.inc")) {
        $GLOBALS["CLASS_UNIX"]->Process1(true);
    }
    if (is_dir("/opt/artica-agent/usr/share/artica-agent/ressources")) {
        events("writing /opt/artica-agent/usr/share/artica-agent/ressources/status.ini", __FUNCTION__, __LINE__);
        @file_put_contents("/opt/artica-agent/usr/share/artica-agent/ressources/status.ini", @implode("\n", $conf));
    }
    if (system_is_overloaded(__FILE__)) {
        ToSyslog("Overloaded system {$GLOBALS["SYSTEM_INTERNAL_LOAD"]} {$GLOBALS["SYSTEM_INTERNAL_MEMM"]}MB Memory free");
        return;
    }
    $cmd = trim("{$GLOBALS["nohup"]} {$GLOBALS["NICE"]} {$GLOBALS["PHP5"]} " . dirname(__FILE__) . "/exec.syslog-engine.php --admin-evs >/dev/null 2>&1 &");
    events($cmd);
    shell_exec2($cmd);
    $cmd = trim("{$GLOBALS["nohup"]} {$GLOBALS["NICE"]} {$GLOBALS["PHP5"]} " . __FILE__ . " --samba >/usr/share/artica-postfix/ressources/logs/web/samba.status 2>&1 &");
    shell_exec2($cmd);
    $GLOBALS["CLASS_UNIX"]->BLKID_ALL();
    events("*****  FINISH {$TOOK} ****", __FUNCTION__, __LINE__);
    events("********************************************************************", __FUNCTION__, __LINE__);
    if ($GLOBALS["VERBOSE"]) {
        echo " *****  FINISH **** \n\n";
    }
}