• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP file_time_min函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: APTCHECK

function APTCHECK()
{
    if (!is_file("/usr/lib/update-notifier/apt-check")) {
        if ($GLOBALS["VERBOSE"]) {
            echo "/usr/lib/update-notifier/apt-check no such file \n";
        }
        events("/usr/lib/update-notifier/apt-check no such file ", __FUNCTION__, __FILE__, __LINE__);
        $datas = ZYPPER_CHECK();
        if (strlen($datas) > 10) {
            return $datas;
        }
        return;
    }
    $cache_file = "/etc/artica-postfix/artica-meta-apt-check.cache";
    $timen = file_time_min($cache_file);
    if (!$GLOBALS["VERBOSE"]) {
        if ($timen < 30) {
            return @file_get_contents($cache_file);
        }
    }
    $EXEC_NICE = EXEC_NICE();
    $cmd = "{$EXEC_NICE}/usr/lib/update-notifier/apt-check 2>&1";
    exec($cmd, $results);
    while (list($index, $line) = each($results)) {
        usleep(35000);
        events("Found: {$line}", __FUNCTION__, __FILE__, __LINE__);
        if (preg_match("#([0-9]+);([0-9]+)#", $line, $re)) {
            $array["UPDATE_PACKAGES"] = $re[1];
            $array["SECURITY_PACKAGES"] = $re[2];
        }
    }
    if ($array["UPDATE_PACKAGES"] > 0) {
        exec("{$EXEC_NICE}/usr/lib/update-notifier/apt-check -p 2>&1", $results2);
        while (list($index, $line) = each($results2)) {
            usleep(35000);
            if (trim($line) == null) {
                continue;
            }
            if (preg_match("#Reading package lists#", $line)) {
                continue;
            }
            if (preg_match("#Building dependency#", $line)) {
                continue;
            }
            if (preg_match("#Reading state information#", $line)) {
                continue;
            }
            $pkg[] = $line;
        }
    }
    if (is_array($pkg)) {
        $array["UPDATE_PACKAGES_LIST"] = @implode(";", $pkg);
    }
    events("UPDATE_PACKAGES_LIST: {$array["UPDATE_PACKAGES_LIST"]}", __FUNCTION__, __FILE__, __LINE__);
    events("UPDATE_PACKAGES.....: {$array["UPDATE_PACKAGES"]}", __FUNCTION__, __FILE__, __LINE__);
    events("SECURITY_PACKAGES...: {$array["SECURITY_PACKAGES"]}", __FUNCTION__, __FILE__, __LINE__);
    @file_put_contents($cache_file, base64_encode(serialize($array)));
    return base64_encode(serialize($array));
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:59,代码来源:exec.artica.meta.php


示例17: bandwith

function bandwith(){
	$file="/usr/share/artica-postfix/ressources/logs/web/bandwith-mon.txt";
	$ftime=file_time_min($file);
	events("$ftime ". basename($file),__FUNCTION__,__LINE__);
	if($ftime<10){return;}
	exec("/usr/share/artica-postfix/bin/bandwith.pl 2>&1",$results);
	$text=@implode("",$results);
	if(!preg_match("#([0-9\.,]+)#",$text,$re)){
		events("$text unable to preg_match",__FUNCTION__,__LINE__);
		return;
	}
	
		$re[1]=str_replace(",",".",$re[1]);
		$mbs=round($re[1],0);
		events("$mbs MB/S bandwith",__FUNCTION__,__LINE__);
		$sql="INSERT INTO bandwith_stats (`zDate`,`bandwith`) VALUES(NOW(),'$mbs');";
		$q=new mysql();
		$q->QUERY_SQL($sql,"artica_events");
		if(!$q->ok){events("$q->mysql_error \"$sql\"",__FUNCTION__,__LINE__);}
		@unlink($file);
		@file_put_contents($file,$mbs);
		@chmod($file,0770);
	}
开发者ID:rsd,项目名称:artica-1.5,代码行数:23,代码来源:exec.status.php


示例18: TestCron

function TestCron($pidfile)
{
    $unix = new unix();
    $pid = trim(@file_get_contents($pidfile));
    if ($unix->process_exists($pid)) {
        $time = file_time_min($pidfile);
        if ($time > 30) {
            events("Already executed pid {$pid} since {$time}Mn (timeout), kill this task", __FUNCTION__, __FILE__, __LINE__);
            $kill = $unix->find_program("kill");
            $cmd = "{$kill} -9 {$pid}";
            events("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
            exec("{$kill} -9 {$pid}", $results);
            sleep(2);
            if ($unix->process_exists($pid)) {
                events("kill {$pid} failed", __FUNCTION__, __FILE__, __LINE__);
                return false;
            } else {
                return true;
            }
        }
        events("Already executed pid {$pid} since {$time}Mn (pid file:{$pidfile}), aborting", __FUNCTION__, __FILE__, __LINE__);
        return false;
    }
    return true;
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:25,代码来源:exec.artica.meta.tasks.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP file_tools_use_folder_structure函数代码示例发布时间:2022-05-15
下一篇:
PHP file_test_reset函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap