當前位置: 首頁>>代碼示例>>PHP>>正文


PHP unix::LOCATE_SYSLOG_PATH方法代碼示例

本文整理匯總了PHP中unix::LOCATE_SYSLOG_PATH方法的典型用法代碼示例。如果您正苦於以下問題:PHP unix::LOCATE_SYSLOG_PATH方法的具體用法?PHP unix::LOCATE_SYSLOG_PATH怎麽用?PHP unix::LOCATE_SYSLOG_PATH使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在unix的用法示例。


在下文中一共展示了unix::LOCATE_SYSLOG_PATH方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: ntpd_events

function ntpd_events()
{
    $unix = new unix();
    $syslog = $unix->LOCATE_SYSLOG_PATH();
    $tmpf = $unix->FILE_TEMP();
    $cmd = $unix->find_program("tail") . " -n 5000 {$syslog}|" . $unix->find_program("grep") . " ntpd >{$tmpf} 2>&1";
    writelogs_framework($cmd, __FUNCTION__, __FILE__, __LINE__);
    shell_exec($cmd);
    $results = explode("\n", @file_get_contents($tmpf));
    @unlink($tmpf);
    writelogs_framework(count($results), __FUNCTION__, __FILE__, __LINE__);
    echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
}
開發者ID:brucewu16899,項目名稱:artica,代碼行數:13,代碼來源:cmd.php

示例2: events_cicap

function events_cicap()
{
    $unix = new unix();
    $syslog = $unix->LOCATE_SYSLOG_PATH();
    $grep = $unix->find_program("grep");
    $tail = $unix->find_program("tail");
    $cmd = "{$grep} -i \"c-icap:\" {$syslog} 2>&1|{$tail} -n 500 >/usr/share/artica-postfix/ressources/logs/web/cicap.events 2>&1";
    shell_exec("{$cmd}");
    writelogs_framework("{$cmd} = " . count($results) . " rows", __FUNCTION__, __FILE__, __LINE__);
}
開發者ID:brucewu16899,項目名稱:1.6.x,代碼行數:10,代碼來源:services.php

示例3: ExportDrop

function ExportDrop()
{
    if ($GLOBALS["EnablePostfixAutoBlock"] != 1) {
        if ($GLOBALS["VERBOSE"]) {
            echo "EnablePostfixAutoBlock={$GLOBALS["EnablePostfixAutoBlock"]}, aborting..\n";
        }
        return;
    }
    $pidpath = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = @file_get_contents($pidpath);
    $unix = new unix();
    if ($unix->process_exists($pid)) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Already executed {$pid}\n";
        }
        return;
    }
    @file_put_contents($pidpath, getmypid());
    $grep = $unix->find_program("grep");
    $tail = $unix->find_program("tail");
    $syslog = $unix->LOCATE_SYSLOG_PATH();
    $NICE = $unix->EXEC_NICE();
    $syslogSize = $unix->file_size($syslog);
    if ($syslogSize > 512000000) {
        include_once dirname(__FILE__) . "/ressources/class.templates.inc";
        $unix->send_email_events("{$syslog} too big (" . str_replace("&nbsp;", " ", FormatBytes($syslogSize / 1024)) . "...", __FUNCTION__ . " is aborted from script " . basename(__FILE__), "system");
        return;
    }
    $cmd = "{$NICE}{$grep} -E \"kernel.*?SMTP DROP\" {$syslog} |{$tail} -n 2000 >/usr/share/artica-postfix/ressources/logs/iptables-smtp-drop.log";
    if ($GLOBALS["VERBOSE"]) {
        echo "{$cmd}\n";
    }
    shell_exec($cmd);
    @chmod("/usr/share/artica-postfix/ressources/logs/iptables-smtp-drop.log", 0777);
}
開發者ID:BillTheBest,項目名稱:1.6.x,代碼行數:35,代碼來源:exec.postfix.iptables.php

示例4: stop_tail_instances

function stop_tail_instances()
{
    $unix = new unix();
    $tail = $unix->find_program("tail");
    $syslog = $unix->LOCATE_SYSLOG_PATH();
    $kill = $unix->find_program("kill");
    $prefix = "{$tail} -f -n 0 {$syslog}";
    $pid = $unix->PIDOF_PATTERN($prefix);
    if (!$unix->process_exists($pid)) {
        return;
    }
    for ($i = 0; $i < 15; $i++) {
        $pid = $unix->PIDOF_PATTERN($prefix);
        if (!$unix->process_exists($pid)) {
            return;
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} killing {$pid} tail instance\n";
        }
        unix_system_kill_force($pid);
    }
}
開發者ID:brucewu16899,項目名稱:1.6.x,代碼行數:22,代碼來源:exec.syslog-init.php

示例5: checksyslog

function checksyslog()
{
    $unix = new unix();
    $syslogpath = $unix->LOCATE_SYSLOG_PATH();
    $size = @filesize($syslogpath);
    echo "Size:{$size}\n";
    if ($size == 0) {
        $unix->RESTART_SYSLOG(true);
    }
}
開發者ID:BillTheBest,項目名稱:1.6.x,代碼行數:10,代碼來源:exec.nosslsearch.google.com.php

示例6: events

function events()
{
    $unix = new unix();
    $syslog = $unix->LOCATE_SYSLOG_PATH();
}
開發者ID:BillTheBest,項目名稱:1.6.x,代碼行數:5,代碼來源:freeradius.php


注:本文中的unix::LOCATE_SYSLOG_PATH方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。