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));
}
예제 #2
0
파일: cmd.php 프로젝트: brucewu16899/artica
function postfixQueues()
{
    $p = new postfix_system();
    $datas = serialize($p->getQueuesNumber());
    echo "<articadatascgi>" . serialize($p->getQueuesNumber()) . "</articadatascgi>";
}