Beispiel #1
0
function CheckPostfixLogs()
{
    $log_path = LOCATE_MAILLOG_PATH();
    $unix = new unix();
    if (!is_file($log_path)) {
        events("CheckPostfixLogs(): Cannot found log path");
        return null;
    }
    $size = filesize($log_path);
    $size = $size / 1024;
    $size = $size / 1000;
    events("CheckPostfixLogs():{$log_path}={$size} MB");
    if ($size == 0) {
        events("CheckPostfixLogs():Restarting postfix");
        if (is_file("/etc/init.d/syslog-ng")) {
            shell_exec("/etc/init.d/syslog-ng restart");
        }
        $unix->send_email_events("Postfix will be restarted", "Line: " . __LINE__ . "\nIn order to rebuild the log file", "postfix");
        shell_exec("/etc/init.d/artica-postfix restart postfix-single");
    }
}
function CheckPostfixLogs()
{
    $log_path = LOCATE_MAILLOG_PATH();
    if (!is_file($log_path)) {
        events("CheckPostfixLogs(): Cannot found log path");
        return null;
    }
    $size = filesize($log_path);
    events("CheckPostfixLogs():{$log_path}={$size} bytes");
    if ($size == 0) {
        events("CheckPostfixLogs():Restarting postfix");
        if (is_file("/etc/init.d/syslog-ng")) {
            shell_exec("/etc/init.d/syslog-ng restart");
        }
        shell_exec("/etc/init.d/artica-postfix restart postfix");
    }
}