本文整理汇总了PHP中unix::events方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::events方法的具体用法?PHP unix::events怎么用?PHP unix::events使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::events方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
function start()
{
$unix = new unix();
$pidpath = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = @file_get_contents($pidpath);
if ($unix->process_exists($pid)) {
$unix->events(basename(__FILE__) . ":: " . __FUNCTION__ . " Already process {$pid} running.. Aborting");
return;
}
$sql = "SELECT * FROM postfinder WHERE finish=0 ORDER BY date_start";
$q = new mysql();
$results = $q->QUERY_SQL($sql, "artica_events");
while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
find($ligne["pattern"]);
}
}
示例2: events
function events($text, $function, $file = null, $line = 0)
{
if ($GLOBALS["OUTPUT"]) {
echo "{$text} in {$function}/{$line}\n";
}
$unix = new unix();
if ($function == null) {
if (function_exists("debug_backtrace")) {
$trace = debug_backtrace();
if (isset($trace[0])) {
$file = basename($trace[0]["file"]);
$function = $trace[0]["function"];
$line = $trace[0]["line"];
}
if (isset($trace[1])) {
$file = basename($trace[1]["file"]);
$function = $trace[1]["function"];
$line = $trace[1]["line"];
}
}
}
$unix->events($text, "/var/log/artica-meta.log", false, $function, $line, $file);
}
示例3: CleanDirLogs
function CleanDirLogs($path)
{
return;
if ($GLOBALS["VERBOSE"]) {
echo "CleanDirLogs({$path})\n";
}
$BigSize = false;
if ($path == '/var/log') {
$BigSize = true;
}
if ($GLOBALS["ArticaMaxLogsSize"] < 100) {
$GLOBALS["ArticaMaxLogsSize"] = 100;
}
$maxday = $GLOBALS["MaxTempLogFilesDay"] * 24;
$maxday = $maxday * 60;
$users = new usersMenus();
$maillog_path = $users->maillog_path;
$unix = new unix();
$sock = new sockets();
$restartSyslog = false;
if ($path == null) {
return;
}
$countfile = 0;
foreach (glob("{$path}/*") as $filepath) {
if ($filepath == null) {
continue;
}
if (is_link($filepath)) {
continue;
}
if (is_dir($filepath)) {
continue;
}
if ($filepath == $maillog_path) {
continue;
}
if (preg_match("#\\/log\\/artica-postfix\\/#", $filepath)) {
continue;
}
$countfile++;
if ($countfile > 500) {
if (is_overloaded()) {
$unix->send_email_events("Clean Files: [{$path}/*] System is overloaded ({$GLOBALS["SYSTEM_INTERNAL_LOAD"]}", "The clean logs function is stopped and wait a new schedule with best performances", "logs_cleaning");
die;
}
$countfile = 0;
}
usleep(300);
$size = round(unix_file_size("{$filepath}") / 1024);
$time = $unix->file_time_min($filepath);
$unix->events("{$filepath} {$size} Ko, {$time}Mn/{$maxday}Mn TTL");
if ($size > $GLOBALS["ArticaMaxLogsSize"]) {
if ($GLOBALS["VERBOSE"]) {
echo "Delete {$filepath}\n";
}
$restartSyslog = true;
$GLOBALS["DELETED_SIZE"] = $GLOBALS["DELETED_SIZE"] + $size;
$GLOBALS["DELETED_FILES"] = $GLOBALS["DELETED_FILES"] + 1;
$GLOBALS["UNLINKED"][] = $filepath;
@unlink($filepath);
continue;
}
if ($time > $maxday) {
$GLOBALS["DELETED_SIZE"] = $GLOBALS["DELETED_SIZE"] + $size;
$GLOBALS["DELETED_FILES"] = $GLOBALS["DELETED_FILES"] + 1;
if ($GLOBALS["VERBOSE"]) {
echo "Delete {$filepath}\n";
}
@unlink($filepath);
$GLOBALS["UNLINKED"][] = $filepath;
$restartSyslog = true;
continue;
}
}
if ($restartSyslog) {
$unix->send_email_events("System log will be restarted", "Logs files was deleted and log daemons will be restarted\n\t\t\t" . @implode("\n", $GLOBALS["UNLINKED"]), "logs_cleaning");
$unix->RESTART_SYSLOG();
}
}
示例4: meta_events
function meta_events($text)
{
$unix = new unix();
if (function_exists("debug_backtrace")) {
$trace = debug_backtrace();
if (isset($trace[0])) {
$file = basename($trace[0]["file"]);
$function = $trace[0]["function"];
$line = $trace[0]["line"];
}
if (isset($trace[1])) {
$file = basename($trace[1]["file"]);
$function = $trace[1]["function"];
$line = $trace[1]["line"];
}
}
$unix->events($text, "/var/log/artica-meta.log", false, $function, $line, $file);
}
示例5: UPGRADE_FROM_INTERFACE
function UPGRADE_FROM_INTERFACE()
{
$unix = new unix();
$php5 = $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__))) {
$timefile = $unix->file_time_min($pidfile);
//$text,$function,$file,$line,$category,$taskid=0
system_admin_events(basename(__FILE__) . ": Already executed pid {$pid} since {$timefile} minutes.. aborting the process", __FUNCTION__, __FILE__, __LINE__, "update");
die;
}
//if(system_is_overloaded(basename(__FILE__))){system_admin_events("Overloaded system... aborting task...",__FUNCTION__,__FILE__,__LINE__,"system-update");die();}
$aptitude = $unix->find_program("aptitude");
if (!is_file($aptitude)) {
return;
}
//if(system_is_overloaded()){$unix->events(basename(__FILE__).": UPGRADE_FROM_INTERFACE() system is overloaded aborting");return;}
$q = new mysql();
$sql = "SELECT * FROM syspackages_updt WHERE upgrade=1 AND progress<90";
$results = $q->QUERY_SQL($sql, "artica_backup");
if (mysql_num_rows($results) == 0) {
return;
}
if (!$q->ok) {
echo "<H2>{$q->mysql_error}</H2>";
}
while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
if ($ligne["package"] == null) {
$q->QUERY_SQL("DELETE FROM syspackages_updt WHERE package=''");
continue;
}
$q->QUERY_SQL("UPDATE syspackages_updt SET progress=50 WHERE package='{$ligne["package"]}'", "artica_backup");
$results2 = array();
$cmd = "{$aptitude} --safe-resolver --allow-untrusted --allow-new-upgrades -q -y full-upgrade {$ligne["package"]} 2>&1";
exec($cmd, $results2);
update_events("Results on upgrade {$ligne["package"]}\n\n" . @implode("\n", $results2), __FUNCTION__, __FILE__, __LINE__, "system-update", "system_update");
$q->QUERY_SQL("UPDATE syspackages_updt SET progress=100 WHERE package='{$ligne["package"]}'", "artica_backup");
if ($GLOBALS["VERBOSE"]) {
echo "{$cmd}\n" . @implode("\n", $results2);
}
if (system_is_overloaded()) {
$unix->events(basename(__FILE__) . ": UPGRADE_FROM_INTERFACE() system is overloaded aborting");
$unix->THREAD_COMMAND_SET("{$php5} " . __FILE__ . " --pkg-upgrade");
return;
}
}
if (!is_file("/etc/cron.d/pkg-upgrade")) {
@unlink("/etc/cron.d/pkg-upgrade");
}
GetUpdates();
}
示例6: updatev2_progress2
function updatev2_progress2($num, $text)
{
$array["POURC"] = $num;
$array["TEXT"] = $text . " " . date("Y-m-d H:i:s");
if ($GLOBALS["VERBOSE"]) {
echo "{$num}% {$text}\n";
}
$unix = new unix();
if (function_exists("debug_backtrace")) {
$trace = debug_backtrace();
if (isset($trace[0])) {
$file = basename($trace[0]["file"]);
$function = $trace[0]["function"];
$line = $trace[0]["line"];
}
if (isset($trace[1])) {
$file = basename($trace[1]["file"]);
$function = $trace[1]["function"];
$line = $trace[1]["line"];
}
}
$unix->events($text, "/var/log/artica-ufdb.log", false, $function, $line, $file);
@file_put_contents("/usr/share/artica-postfix/ressources/logs/web/cache/webfilter-artica.progress", serialize($array));
}
示例7: backupevents
function backupevents($text)
{
$unix = new unix();
$unix->events($text, "/var/log/artica-backup.log");
}
示例8: Events
function Events($text)
{
if (function_exists("debug_backtrace")) {
$trace = debug_backtrace();
if (isset($trace[1])) {
$sourcefile = basename($trace[1]["file"]);
$sourcefunction = $trace[1]["function"];
$sourceline = $trace[1]["line"];
}
}
$unix = new unix();
$unix->events($text, dirname(__FILE__) . "/ressources/logs/web/squid.downgrade.html", false, $sourcefunction, $sourceline);
@chmod(dirname(__FILE__) . "/ressources/logs/web/squid.downgrade.html", 0755);
}
示例9: events
function events($text, $function = null, $line = 0)
{
if ($GLOBALS["VERBOSE"]) {
echo "{$function}:: {$text} (L.{$line})\n";
return;
}
$filename = basename(__FILE__);
$unix = new unix();
$unix->events("{$filename} {$function}:: {$text} (L.{$line})", "/var/log/perfs_queue.log");
}
示例10: events
function events($text, $function = null, $line = null)
{
$unix = new unix();
if (function_exists("debug_backtrace")) {
$trace = debug_backtrace();
if (isset($trace[1])) {
$sourcefile = basename($trace[1]["file"]);
if ($function == null) {
$function = $trace[1]["function"];
}
if ($line == null) {
$line = $trace[1]["line"];
}
}
}
$unix->events($text, "/var/log/artica-network.log", false, $function, $line);
}
示例11: seeker_log
function seeker_log($text, $line)
{
$unix = new unix();
$unix->events($text, "/var/log/seeker.log", false, "seeker", $line, basename(__FILE__));
}
示例12: events
function events($text, $sourcefunction = null, $sourcefile = null, $sourceline = 0)
{
if (function_exists("debug_backtrace")) {
$trace = debug_backtrace();
if (isset($trace[1])) {
if ($sourcefile == null) {
$sourcefile = basename($trace[1]["file"]);
}
if ($sourcefunction == null) {
$sourcefunction = $trace[1]["function"];
}
if ($sourceline == null) {
$sourceline = $trace[1]["line"];
}
}
}
$unix = new unix();
$unix->events($text, "/var/log/postfix.stats.log", false, $sourcefunction, $sourceline, basename(__FILE__));
}
示例13: notify_remote_proxys
function notify_remote_proxys($COMMANDS = null)
{
$unix = new unix();
include_once dirname(__FILE__) . "/ressources/class.blackboxes.inc";
$EXEC_PID_FILE = "/etc/artica-postfix/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$EXEC_PID_TIME = "/etc/artica-postfix/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$pid = @file_get_contents($EXEC_PID_FILE);
if ($unix->process_exists($pid, basename(__FILE__))) {
$timefile = $unix->file_time_min($EXEC_PID_FILE);
if ($timefile < 15) {
$unix->events("Skipping, Already executed pid {$pid} {$timefile}Mn", "/var/log/stats-appliance.log");
ufdbguard_admin_events("Skipping, Already executed pid {$pid} {$timefile}Mn...", __FUNCTION__, __FILE__, __LINE__, "communicate");
return;
}
$kill = $unix->find_program("kill");
unix_system_kill_force($pid);
}
@file_put_contents($EXEC_PID_FILE, getmypid());
if ($COMMANDS == null) {
$COMMANDS = "BUILDCONF";
}
if ($COMMANDS == "PING") {
$time = $unix->file_time_min($EXEC_PID_TIME);
if (!$GLOBALS["VERBOSE"]) {
if ($time < 5) {
return;
}
}
@unlink($EXEC_PID_TIME);
@file_put_contents($EXEC_PID_TIME, time());
$bb = new blackboxes();
$bb->NotifyAll("PING");
return;
}
$t = time();
$f = new squid_stats_appliance();
$f->export_tables();
$took = $unix->distanceOfTimeInWords($t, time(), true);
ufdbguard_admin_events("Exporting MySQL datas done... took:{$took}", __FUNCTION__, __FILE__, __LINE__, "communicate");
$unix->events("Exporting MySQL datas done... took:{$took}", "/var/log/stats-appliance.log");
include_once dirname(__FILE__) . "/ressources/class.blackboxes.inc";
$unix->events("Send order to appliance(s)", "/var/log/stats-appliance.log");
$bb = new blackboxes();
$bb->NotifyAll("BUILDCONF");
}
示例14: events
function events($text, $line)
{
$unix = new unix();
$unix->events($text, "/var/log/mimedefang-postgres.log", false, "xrun", $line);
}
示例15: ngx_mail_events
function ngx_mail_events($text, $line)
{
$unix = new unix();
$unix->events($text, "/var/log/artica-proxy-mail.log", false, "MAIN", $line);
}