当前位置: 首页>>代码示例>>PHP>>正文


PHP file_time_min函数代码示例

本文整理汇总了PHP中file_time_min函数的典型用法代码示例。如果您正苦于以下问题:PHP file_time_min函数的具体用法?PHP file_time_min怎么用?PHP file_time_min使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了file_time_min函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: watchdog

function watchdog()
{
    $ini = new Bs_IniHandler("/etc/artica-postfix/smtpnotif.conf");
    $PostfixQueueEnabled = $ini->get("SMTP", "PostfixQueueEnabled");
    $PostfixQueueMaxMails = $ini->get("SMTP", "PostfixQueueMaxMails");
    if ($PostfixQueueEnabled == null) {
        $PostfixQueueEnabled = 1;
    }
    if ($PostfixQueueMaxMails == null) {
        $PostfixQueueMaxMails = 20;
    }
    if ($PostfixQueueEnabled != 1) {
        return;
    }
    $postfix_system = new postfix_system();
    $array = $postfix_system->getQueuesNumber();
    while (list($num, $val) = each($array)) {
        $logs[] = "{$num}={$val} message(s)";
        if (intval($val) > $PostfixQueueMaxMails) {
            if (is_file("/etc/artica-postfix/croned.1/postfix.{$num}.exceed")) {
                if (file_time_min("/etc/artica-postfix/croned.1/postfix.{$num}.exceed") < 30) {
                    continue;
                }
            }
            @file_put_contents("/etc/artica-postfix/croned.1/postfix.{$num}.exceed", "#");
            $subject = "Postfix queue {$num} exceed limit";
            $text = "The {$num} storage queue contains {$val} messages\nIt exceed the maximum {$PostfixQueueMaxMails} messages number...";
            send_email_events($subject, $text, 'system');
        }
    }
    $logs[] = "{$num}={$val} message(s)";
    RTMevents(implode(" ", $logs));
}
开发者ID:brucewu16899,项目名称:artica,代码行数:33,代码来源:exec.watchdog.postfix.queue.php

示例2: CleanArticaUpdateLogs

function CleanArticaUpdateLogs()
{
    foreach (glob("/var/log/artica-postfix/artica-update-*.debug") as $filename) {
        $file_time_min = file_time_min($filename);
        if (file_time_min($filename) > 5752) {
            @unlink($filename);
        }
    }
}
开发者ID:brucewu16899,项目名称:artica,代码行数:9,代码来源:exec.cleanfiles.php

示例3: fetchtimeout

function fetchtimeout($server, $port, $ip, $buffer)
{
    $file = "/etc/artica-postfix/cron.1/" . md5(__FILE__) . "-" . md5("{$server},{$port},{$ip}");
    if (file_time_min($file) < 15) {
        return null;
    }
    send_email_events("fetchmail network error on  {$server} {$port}", "fetchmail claim \"{$buffer}\", please set the right server for fetching messages", 'system');
    @unlink($file);
    @file_put_contents("#", $file);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:10,代码来源:exec.fetmaillog.php

示例4: launch_tests

function launch_tests()
{
    $unix = new unix();
    $php = $unix->LOCATE_PHP5_BIN();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        return;
    }
    if (system_is_overloaded(basename(__FILE__))) {
        system_admin_events("Overloaded, aborting task...", __FUNCTION__, __FILE__, __LINE__, "system");
        $unix->THREAD_COMMAND_SET("{$php} " . __FILE__);
        return;
    }
    @file_put_contents($pidfile, getmypid());
    $datafile = "/etc/artica-postfix/settings/Daemons/HdparmInfos";
    writelogs("Testing hard drives ({$datafile})", __FUNCTION__, __FILE__, __LINE__);
    $timenum = file_time_min($datafile);
    if (is_file($datafile)) {
        if (file_time_min($datafile) < 61) {
            writelogs("{$timenum}Mn executed, waiting 60Mn", __FUNCTION__, __FILE__, __LINE__);
            die;
        }
    }
    if ($GLOBALS["FIND_HDPARM"] == null) {
        writelogs("Unable to stat 'hdparm'", __FUNCTION__, __FILE__, __LINE__);
        die;
    }
    $disks = GetDisks();
    if (!is_array($disks)) {
        return null;
    }
    while (list($index, $line) = each($disks)) {
        unset($results);
        exec("{$GLOBALS["FIND_HDPARM"]} -t {$index}", $results);
        while (list($num, $line_result) = each($results)) {
            if (preg_match("#=\\s+([0-9\\.]+)\\s+MB\\/sec\$#", $line_result, $re)) {
                if (preg_match("#.+?\\/(.+)\$#", $index, $ri)) {
                    system_admin_events("{$ri[1]}:{$re[1]}MB/sec", __FUNCTION__, __FILE__, __LINE__, "system");
                    writelogs("testing disk {$ri[1]}:{$re[1]}MB/sec...", __FUNCTION__, __FILE__, __LINE__);
                    $array[$ri[1]] = $re[1];
                }
            }
        }
    }
    @unlink($datafile);
    @file_put_contents($datafile, base64_encode(serialize($array)));
    if (!is_file($datafile)) {
        writelogs("{$datafile} no such file or directory", __FUNCTION__, __FILE__, __LINE__);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:51,代码来源:exec.hdparm.php

示例5: IfFileTime

function IfFileTime($file,$min=10){
	$time=file_time_min($file);
	events("$file = {$time}Mn Max:$min");
	if($time>$min){return true;}
	return false;
}
开发者ID:rsd,项目名称:artica-1.5,代码行数:6,代码来源:exec.syslog.php

示例6: Global_Applications_Status

function Global_Applications_Status()
{
    if (isset($_GET["status-forced"])) {
        sys_THREAD_COMMAND_SET('/usr/share/artica-postfix/bin/artica-install --generate-status --forced');
        return;
    }
    if (!is_file('/usr/share/artica-postfix/ressources/logs/global.versions.conf')) {
        sys_exec('/usr/share/artica-postfix/bin/artica-install -versions > /usr/share/artica-postfix/ressources/logs/global.versions.conf 2>&1');
    }
    if (!is_file('/usr/share/artica-postfix/ressources/logs/global.status.ini')) {
        sys_exec('/usr/share/artica-postfix/bin/artica-install --status > /usr/share/artica-postfix/ressources/logs/global.status.ini 2>&1');
    }
    $datas = @file_get_contents('/usr/share/artica-postfix/ressources/logs/global.status.ini');
    $datas2 = @file_get_contents('/usr/share/artica-postfix/ressources/logs/global.versions.conf');
    if (file_time_min('/usr/share/artica-postfix/ressources/logs/global.status.ini') > 10) {
        @unlink('/usr/share/artica-postfix/ressources/logs/global.status.ini');
        @unlink('/usr/share/artica-postfix/ressources/logs/global.versions.conf');
        sys_THREAD_COMMAND_SET('/usr/share/artica-postfix/bin/artica-install --write-versions');
        sys_THREAD_COMMAND_SET('/usr/share/artica-postfix/bin/artica-install --generate-status');
    }
    $unix = new unix();
    $tmp = $unix->FILE_TEMP();
    exec("/bin/chmod 755 /usr/share/artica-postfix/ressources/logs/global.* >{$tmp} 2>&1");
    @unlink($tmp);
    writelogs_framework("datas=" . strlen($datas) . " bytes datas2=" . strlen($datas) . " bytes", __FUNCTION__, __FILE__, __LINE__);
    echo "<articadatascgi>" . base64_encode("{$datas}\n{$datas2}") . "</articadatascgi>";
}
开发者ID:brucewu16899,项目名称:artica,代码行数:27,代码来源:cmd.php

示例7: ParseLastEvents

function ParseLastEvents()
{
    $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $timeF = file_time_min($timefile);
    if ($timeF < 240) {
        if ($GLOBALS["VERBOSE"]) {
            echo "{$timeF} minutes, need to wait 240\n";
        }
        return;
    }
    @file_put_contents($timefile, "#");
    $unix = new unix();
    $iptables = $unix->find_program("iptables");
    if ($GLOBALS["VERBOSE"]) {
        echo "Loading Whitelist\n";
    }
    $whitelist = load_whitelist();
    if ($GLOBALS["VERBOSE"]) {
        echo "Loading Whitelist " . count($whitelist) . " items\n";
    }
    $sock = new sockets();
    $PostfixInstantIptablesLastDays = $sock->GET_INFO("PostfixInstantIptablesLastDays");
    $PostfixInstantIptablesMaxEvents = $sock->GET_INFO("PostfixInstantIptablesMaxEvents");
    if (!is_numeric($PostfixInstantIptablesLastDays)) {
        $PostfixInstantIptablesLastDays = 7;
    }
    if (!is_numeric($PostfixInstantIptablesMaxEvents)) {
        $PostfixInstantIptablesMaxEvents = 50;
    }
    $sql = "SELECT COUNT(ipaddr) as tcount,ipaddr,smtp_err,hostname \n\tFROM mail_con_err_stats WHERE zDate<DATE_SUB(NOW(),INTERVAL 1 DAY) \n\tAND zDate>=DATE_SUB(NOW(),INTERVAL {$PostfixInstantIptablesLastDays} DAY) \n\tGROUP BY ipaddr,smtp_err,hostname ORDER BY COUNT(ipaddr) DESC";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_events");
    $newarray = array();
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $count_events = $ligne["tcount"];
        if ($count_events < 3) {
            break;
        }
        $ipaddr = $ligne["ipaddr"];
        $error = $ligne["smtp_err"];
        $server_name = $ligne["hostname"];
        if ($whitelist[$server_name]) {
            echo "Whitelisted {$server_name}\n";
            continue;
        }
        if ($whitelist[$ipaddr]) {
            echo "Whitelisted {$ipaddr}\n";
            continue;
        }
        $newarray[$ipaddr]["HOST"] = $server_name;
        $newarray[$ipaddr]["EVENTS_TEXT"][] = "{$server_name} [{$ipaddr}] - {$count_events} {$error}";
        if (isset($newarray[$ipaddr])) {
            $newarray[$ipaddr]["EVENTS"] = $newarray[$ipaddr]["EVENTS"] + $count_events;
        } else {
            $newarray[$ipaddr]["EVENTS"] = $newarray[$ipaddr]["EVENTS"];
        }
    }
    if (!is_array($newarray)) {
        return;
    }
    $newarray2 = $newarray;
    while (list($ipaddr, $ligne) = each($newarray)) {
        $count = $ligne["EVENTS"];
        if ($count < $PostfixInstantIptablesMaxEvents) {
            unset($newarray2[$ipaddr]);
            //if($GLOBALS["VERBOSE"]){echo "skipping $ipaddr {$ligne["HOST"]} $count events\n";}
            continue;
        }
    }
    if ($GLOBALS["VERBOSE"]) {
        echo count($newarray2) . " items -> Array:newarray2\n";
    }
    if (count($newarray2) == 0) {
        return;
    }
    $ipCount = 0;
    while (list($ipaddr, $ipaddrARR) = each($newarray2)) {
        $sql = "SELECT rulemd5 FROM iptables WHERE serverip='{$ipaddr}' AND local_port='25'";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        if ($ligne["rulemd5"] != null) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Skip {$ipaddr} already added\n";
            }
            continue;
        }
        $EVENTS = "{$ipaddrARR["EVENTS"]} refused connexions:\n" . @implode("\n", $ipaddrARR["EVENTS_TEXT"]);
        $cmd = "{$iptables} -A INPUT -s {$ipaddr} -p tcp --destination-port 25 -j DROP -m comment --comment \"ArticaInstantPostfix\"";
        $iptablesClass = new iptables_chains();
        $iptablesClass->serverip = $ipaddr;
        $iptablesClass->servername = $server_name;
        $iptablesClass->rule_string = $cmd;
        $iptablesClass->EventsToAdd = $EVENTS;
        if (!$iptablesClass->addPostfix_chain()) {
            $FAILED = "FAILED TO add {$ipaddr} ";
        }
        $notifs[] = $EVENTS;
        shell_exec($cmd);
        if ($GLOBALS["VERBOSE"]) {
            echo $cmd . "\n";
        }
//.........这里部分代码省略.........
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:101,代码来源:exec.postfix.iptables.php

示例8: loadavg_old

function loadavg_old(){
	$unix=new unix();
	@mkdir("/etc/artica-postfix/croned.1",0666,true);
	$unix=new unix();
	$pidfile="/etc/artica-postfix/".basename(__FILE__).".".__FUNCTION__.".pid";
	$pid=trim(@file_get_contents($pidfile));
	if($unix->process_exists($pid)){die();}

	$pid=getmypid();
	@file_put_contents($pidfile,$pid);
	
	$timefile="/etc/artica-postfix/croned.1/".basename(__FILE__).__FUNCTION__;
	if(file_time_min($timefile)<15){return null;}
	@unlink($timefile);
	@file_put_contents($timefile,"#");
	
	
	$array_load=sys_getloadavg();
	$internal_load=$array_load[0];		
	$datas=loadavg_table();
	if($GLOBALS["VERBOSE"]){echo strlen($datas)." bytes body text\n";}	
	$unix->send_email_events("System Load - $internal_load - exceed rule ",$datas,"system");
	checkProcess1();
}
开发者ID:rsd,项目名称:artica-1.5,代码行数:24,代码来源:exec.watchdog.php

示例9: Group2

function Group2()
{
    $fileTime = "/etc/artica-postfix/cron.2/executor." . __FUNCTION__;
    if (file_time_min($fileTime) < 2) {
        return;
    }
    $array[] = "exec.dhcpd-leases.php";
    $array[] = "exec.mailbackup.php";
    if ($GLOBALS["DANSGUARDIAN_INSTALLED"]) {
        $array[] = "exec.dansguardian.injector.php";
    }
    if (is_array($array)) {
        while (list($index, $file) = each($array)) {
            $cmd = "{$_GET["PHP5"]} /usr/share/artica-postfix/{$file}";
            sys_THREAD_COMMAND_SET($cmd);
        }
    }
    if (is_array($array2)) {
        while (list($index, $file) = each($array2)) {
            $cmd = "/usr/share/artica-postfix/bin/{$file}";
            sys_THREAD_COMMAND_SET($cmd);
        }
    }
    @unlink($fileTime);
    @file_put_contents($fileTime, "#");
}
开发者ID:brucewu16899,项目名称:artica,代码行数:26,代码来源:exec.executor.php

示例10: find

function find($pattern)
{
    $SEARCH["PATTERN"] = $pattern;
    $md5Pattern = md5($pattern);
    $pattern = str_replace(".", "\\.", $pattern);
    $pattern = str_replace("*", ".+?", $pattern);
    $MONTHS = array("Jan" => 1, "Feb" => 2, "Mar" => 3, "Apr" => 4, "May" => 5, "Jun" => 6, "Jul" => 7, "Aug" => 8, "Sep" => 9, "Oct" => 10, "Nov" => 11, "Dec" => 12);
    $POSTIDS = array();
    $unix = new unix();
    $sock = new sockets();
    $BackupMailLogPath = $sock->GET_INFO("BackupMailLogPath");
    if ($BackupMailLogPath == null) {
        $BackupMailLogPath = "/home/logrotate_backup";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "BackupMailLogPath={$BackupMailLogPath}\n";
    }
    $filecache = "{$BackupMailLogPath}/{$md5Pattern}.search";
    $sql = "UPDATE postfinder SET finish=-1 WHERE `md5`='{$md5Pattern}'";
    $q = new mysql();
    $q->QUERY_SQL($sql, 'artica_events');
    if (!$q->ok) {
        echo $q->mysql_error;
    }
    $grep = $unix->find_program("grep");
    $cmd = "{$grep} -E \"{$pattern}\" {$BackupMailLogPath}/*.log 2>&1 >{$filecache}";
    if (!is_file($filecache)) {
        if ($GLOBALS["VERBOSE"]) {
            echo "{$filecache} no such file -> {$cmd} \n";
        }
        shell_exec($cmd);
    } else {
        $timefile = file_time_min($filecache);
        if ($timefile > 10) {
            shell_exec($cmd);
        }
    }
    $DATES = array();
    $handle = @fopen("{$filecache}", "r");
    // Open file form read.
    if ($handle) {
        while (!feof($handle)) {
            $ligne = fgets($handle, 4096);
            if (preg_match("#:([A-Za-z]+)\\s+([0-9]+)\\s+([0-9:]+)\\s+.+?\\[[0-9]+\\]:\\s+([0-9A-Z]+):#", $ligne, $re)) {
                $month = $MONTHS[$re[1]];
                if (strpos($ligne, "KASINFO") > 0) {
                    continue;
                }
                if (strlen($month) == 1) {
                    $month = "0{$month}";
                }
                $year = date('Y');
                if (strlen($re[2])) {
                    $re[2] = "0{$re['2']}";
                }
                $date = "{$year}-{$month}-{$re[2]} {$re[3]}";
                $time = strtotime($date);
                $postid = $re[4];
                if ($postid == "NOQUEUE") {
                    if ($GLOBALS["VERBOSE"]) {
                        echo "{$ligne} skip\n";
                    }
                    $POSTIDS[$time][md5($ligne)][] = $ligne;
                    continue;
                }
                $DATES[$time] = $postid;
            }
        }
    } else {
        if ($GLOBALS["VERBOSE"]) {
            echo "{$filecache} unable to read\n";
        }
    }
    if (count($DATES) > 0) {
        krsort($DATES);
        while (list($time, $msg_id) = each($DATES)) {
            $results = array();
            $cmd = "{$grep} -h \"{$msg_id}\" {$BackupMailLogPath}/*.log 2>&1";
            exec($cmd, $results);
            $POSTIDS[$time][$msg_id] = $results;
        }
    }
    $cc = 0;
    while (list($time, $msg_id) = each($POSTIDS)) {
        $cc++;
    }
    reset($POSTIDS);
    krsort($POSTIDS);
    $finals = addslashes(serialize($POSTIDS));
    $now = date('Y-m-d H:i:s');
    $sql = "UPDATE postfinder SET finish=1, date_end='{$now}', search_datas='{$finals}',msg_num={$cc} WHERE `md5`='{$md5Pattern}'";
    $q = new mysql();
    $q->QUERY_SQL($sql, 'artica_events');
    if (!$q->ok) {
        echo $q->mysql_error;
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:97,代码来源:exec.postfix.finder.php

示例11: include_once

include_once(dirname(__FILE__).'/ressources/class.users.menus.inc');
$GLOBALS["ADDLOG"]="/var/log/artica-postfix/".basename(__FILE__).".log";
$users=new usersMenus();
if(!$users->SQUID_INSTALLED){die();}
$file="/usr/share/artica-postfix/ressources/databases/UserAgents.txt";
if(!is_file($file)){die();}
$pidfile="/etc/artica-postfix/".basename(__FILE__).".pid";
$unix=new unix();
if($unix->process_exists(trim(@file_get_contents($pidfile)))){
	writelogs("Another instance ". @file_get_contents($pidfile). " Exists... abort","MAIN",__FILE__,__LINE__);
	die();
}
$pid=getmypid();
@file_put_contents($pidfile,$pid);

$time=file_time_min("/etc/artica-postfix/UserAgents.cache");
if($time<10080){die();}


$f=@file_get_contents($file);

$md5=md5($f);
$oldMd5=md5(trim(@file_get_contents("/etc/artica-postfix/UserAgents.cache")));
writelogs("$md5 == $oldMd5","MAIN",__FILE__,__LINE__);
if($md5==$oldMd5){
	writelogs("No changes","MAIN",__FILE__,__LINE__);
	die();
}
@file_put_contents("/etc/artica-postfix/UserAgents.cache","$md5");

$q=new mysql();
开发者ID:rsd,项目名称:artica-1.5,代码行数:31,代码来源:exec.users-agents.php

示例12: DeleteMysqlError

function DeleteMysqlError()
{
    foreach (glob("{$GLOBALS["ARTICALOGDIR"]}/mysql-error.*.err") as $filename) {
        if (file_time_min($filename) > 5) {
            @unlink($filename);
        }
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:8,代码来源:exec.mailarchiver.php

示例13: smbtree

function smbtree(){
	$unix=new unix();
	$timefile="/etc/artica-postfix/smbtree.cache";
	$smbtree=$unix->find_program("smbtree");
	if(!is_file($smbtree)){return;}
	$time=file_time_min($timefile);
	if($time>5){
		exec("$smbtree -N 2>&1",$results);
		@file_put_contents($timefile,serialize($results));
	}
	$results=unserialize(@file_get_contents($timefile));
	
	$final=array();
	while (list ($index, $ligne) = each ($results)){
		$ligne=trim($ligne);
		if($GLOBALS["VERBOSE"]){echo "check \"$ligne\"\n";}
		if(preg_match("#^([A-Za-z0-9\_\-]+)$#",$ligne,$re)){
				if($GLOBALS["VERBOSE"]){echo "Found DOMAIN {$re[1]}\n";}
				$DOMAIN=$re[1];
				continue;
			}

		$tr=explode('\\',$ligne);
		if(count($tr)>0){
			unset($tr[0]);
			unset($tr[1]);
			if(count($tr)>1){
				$final[$DOMAIN][$tr[2]]["IP"]=nmblookup($tr[2],null);
				$final[$DOMAIN][$tr[2]]["SHARES"][]=$tr[3];
			}
		
		}
	}
	
	@file_put_contents("/usr/share/artica-postfix/ressources/logs/smbtree.array",serialize($final));
	shell_exec("/bin/chmod 777 /usr/share/artica-postfix/ressources/logs/smbtree.array");
	
}
开发者ID:rsd,项目名称:artica-1.5,代码行数:38,代码来源:exec.samba.php

示例14: Parseline

function Parseline($buffer)
{
    $buffer = trim($buffer);
    if ($buffer == null) {
        return null;
    }
    if (dustbin($buffer)) {
        return null;
    }
    if (!isset($GLOBALS["CHMOD"])) {
        $unix = new unix();
        $GLOBALS["CHMOD"] = $unix->find_program("chmod");
    }
    if ($GLOBALS["VERBOSE"]) {
        events(" - > " . __LINE__);
    }
    if (count($GLOBALS["DNSISSUES"]) > 1) {
        $curdate = date("YmdHi");
        $curcount = count($GLOBALS["DNSISSUES"][$curdate]);
        unset($GLOBALS["DNSISSUES"]);
        $GLOBALS["DNSISSUES"][$curdate] = $curcount;
    }
    $GLOBALS["COUNTLINES"]++;
    if ($GLOBALS["COUNTLINES"] > 20) {
        @unlink("/etc/artica-postfix/pids/squid-cache-logs.time");
        @file_put_contents("/etc/artica-postfix/pids/squid-cache-logs.time", time());
        $GLOBALS["COUNTLINES"] = 0;
    }
    if (preg_match("#FD [0-9]+ Closing HTTP connection#", $buffer)) {
        return;
    }
    if (preg_match("#temporary disabling.*?digest from#", $buffer)) {
        return;
    }
    if (preg_match("#kid[0-9]+\\| .*?\\/[0-9]+ exists#", $buffer)) {
        return;
    }
    //*******************************************************************************************************************
    if (preg_match("#logfileHandleWrite:.*?error(.+)#", $buffer, $re)) {
        squid_admin_mysql(1, "Artica logger issue {$re[1]} [action=warn]", $buffer, __FILE__, __LINE__);
        return;
    }
    //*******************************************************************************************************************
    if (preg_match("#FATAL: Cannot open SNMP receiving Port#", $buffer, $re)) {
        squid_admin_mysql(0, "SNMP option issue! [action=disable SNMP]", $buffer, __FILE__, __LINE__);
        shell_exec("{$GLOBALS["NOHUP"]} {$GLOBALS["PHP5"]} /usr/share/artica-postfix/exec.squid.watchdog.php --disable-snmp >/dev/null 2>&1");
        return;
    }
    //*******************************************************************************************************************
    if (preg_match("#FATAL: The\\s+(.*?)\\s+helpers are crashing too rapidly, need help#", $buffer, $re)) {
        squid_admin_mysql(0, "Herlpers [{$re[1]}] issue! [action=emergency!]", "The proxy claims about an helper that crashing, Artica pass your proxy service into emergency mode!\n{$buffer}", __FILE__, __LINE__);
        @file_put_contents("/etc/artica-postfix/settings/Daemons/SquidUrgency", 1);
        shell_exec("{$GLOBALS["NOHUP"]} {$GLOBALS["PHP5"]} /usr/share/artica-postfix/exec.squid.php --build --force >/dev/null 2>&1 &");
    }
    //*******************************************************************************************************************
    if (preg_match("#FATAL: I don't handle this error well#", $buffer, $re)) {
        $file = "/etc/artica-postfix/pids/squid.did.handle.error.well";
        $timefile = file_time_min($file);
        if ($timefile > 10) {
            squid_admin_mysql(0, "Error that proxy did not handle very well! [action=restart-forced]", $buffer, __FILE__, __LINE__);
            shell_exec("{$GLOBALS["NOHUP"]} /etc/init.d/squid restart --force --cache-logs >/dev/null 2>&1 &");
            @unlink($file);
            @file_put_contents($file, time());
        }
        return;
    }
    //*******************************************************************************************************************
    if (preg_match("#WARNING: All [0-9]+\\/([0-9]+)\\s+BasicFakeAuth processes are busy#", $buffer, $re)) {
        $file = "/etc/artica-postfix/pids/squid.external.BasicFakeAuth.queue.overload";
        $timefile = file_time_min($file);
        if ($timefile > 3) {
            $SquidClientParams = unserialize(base64_decode($GLOBALS["CLASS_SOCKETS"]->GET_INFO("SquidClientParams")));
            if (!is_numeric($SquidClientParams["external_acl_children"])) {
                $SquidClientParams["external_acl_children"] = 5;
            }
            if (!is_numeric($SquidClientParams["external_acl_startup"])) {
                $SquidClientParams["external_acl_startup"] = 1;
            }
            if (!is_numeric($SquidClientParams["external_acl_idle"])) {
                $SquidClientParams["external_acl_idle"] = 1;
            }
            $SquidClientParams["external_acl_children"] = $SquidClientParams["external_acl_children"] + 2;
            $SquidClientParams["external_acl_startup"] = $SquidClientParams["external_acl_startup"] + 2;
            $SquidClientParams["external_acl_idle"] = $SquidClientParams["external_acl_idle"] + 2;
            $GLOBALS["CLASS_SOCKETS"]->SaveConfigFile(base64_encode(serialize($SquidClientParams)), "SquidClientParams");
            shell_exec("{$GLOBALS["NOHUP"]} {$GLOBALS["PHP5"]} /usr/share/artica-postfix/exec.squid.php --build --force >/dev/null 2>&1 &");
            $text = "{$buffer}\n\t\t\tNew parameters has been set and the proxy service was reconfigurer with:\n\t\t\texternal_acl_children = {$SquidClientParams["external_acl_children"]}\n\t\t\texternal_acl_startup  = {$SquidClientParams["external_acl_startup"]}\n\t\t\texternal_acl_idle     = {$SquidClientParams["external_acl_idle"]}\n\t\t\t";
            squid_admin_mysql(1, "BasicFakeAuth ACL queue overloaded increase it", "{$text}");
            @unlink($file);
            @file_put_contents($file, time());
            return;
        }
        return;
    }
    //*******************************************************************************************************************
    if (preg_match("#\\/swap\\.state:.*?Read-only file system#", $buffer, $re)) {
        if (TimeStampTTL(__LINE__, 2)) {
            squid_admin_mysql(0, "{$re[1]} File system in read-only! suggest to reboot the server !", $buffer, __FILE__, __LINE__);
        }
        return;
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:exec.cache-logs.php

示例15: zarafa_rebuild_db

function zarafa_rebuild_db($table, $buffer)
{
    $file = "/etc/artica-postfix/cron.1/" . __FUNCTION__;
    if (file_time_min($file) < 15) {
        events("Zarafa missing table <{$table}>, time-out");
        return null;
    }
    @unlink($file);
    email_events("Zarafa missing Mysql table {$table}", "Service Zarafa claim \"{$buffer}\" artica will destroy the zarafa database in order to let the Zarafa service create a new one' ", 'mailbox');
    THREAD_COMMAND_SET("{$GLOBALS["PHP5_BIN"]} " . dirname(__FILE__) . "/exec.mysql.build.php --rebuild-zarafa");
    @file_put_contents($file, "#");
    return;
}
开发者ID:brucewu16899,项目名称:artica,代码行数:13,代码来源:exec.maillog.php


注:本文中的file_time_min函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。