本文整理汇总了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>";
}
示例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__);
}
示例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(" ", " ", 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);
}
示例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);
}
}
示例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);
}
}
示例6: events
function events()
{
$unix = new unix();
$syslog = $unix->LOCATE_SYSLOG_PATH();
}