本文整理汇总了PHP中unix::_syslog方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::_syslog方法的具体用法?PHP unix::_syslog怎么用?PHP unix::_syslog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unix
的用法示例。
在下文中一共展示了unix::_syslog方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: user_status_table
function user_status_table()
{
if (isset($GLOBALS["user_status_table_executed"])) {
if ($GLOBALS["VERBOSE"]) {
$trace = debug_backtrace();
if (isset($trace[1])) {
$called = " called by " . basename($trace[1]["file"]) . " {$trace[1]["function"]}() line {$trace[1]["line"]}";
echo "user_status_table Already executed {$called}\n";
}
}
return;
}
$GLOBALS["user_status_table_executed"] = true;
$unix = new unix();
$sock = new sockets();
$timefile = "/usr/share/artica-postfix/ressources/databases/ZARAFA_DB_STATUS.db";
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$mns = $unix->file_time_min($timefile);
if ($GLOBALS["VERBOSE"]) {
echo "{$timefile} = {$mns}Mn\n";
}
if (!$GLOBALS["FORCE"]) {
if (system_is_overloaded(basename(__FILE__))) {
system_admin_events("Overload system, aborting", __FUNCTION__, __FILE__, __LINE__, "zarafa");
return;
}
if ($mns < 180) {
return;
}
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$timeProcess = $unix->PROCCESS_TIME_MIN($pid);
system_admin_events("{$pid}, task is already executed (since {$timeProcess}Mn}), aborting", __FUNCTION__, __FILE__, __LINE__, "zarafa");
if ($timeProcess < 15) {
return;
}
$kill = $unix->find_program("kill");
unix_system_kill_force($pid);
system_admin_events("{$pid}, killed (since {$timeProcess}Mn}), aborting", __FUNCTION__, __FILE__, __LINE__, "zarafa");
}
}
@file_put_contents($pidfile, getmypid());
@unlink($timefile);
@file_put_contents($timefile, time());
$ZarafaIndexPath = $sock->GET_INFO("ZarafaIndexPath");
$ZarafaStoreOutsidePath = $sock->GET_INFO("ZarafaStoreOutsidePath");
$ZarafaMySQLServiceType = $sock->GET_INFO("ZarafaMySQLServiceType");
if (!is_numeric($ZarafaMySQLServiceType)) {
$ZarafaMySQLServiceType = 1;
}
// $ZarafaMySQLServiceType =1 ou 2 /var/lib/mysql
// $ZarafaMySQLServiceType =3 --> dedicated instance
if ($ZarafaIndexPath == null) {
$ZarafaIndexPath = "/var/lib/zarafa/index";
}
if ($ZarafaStoreOutsidePath == null) {
$ZarafaStoreOutsidePath = "/var/lib/zarafa";
}
$ARRAY["ZARAFA_INDEX"] = $unix->DIRSIZE_BYTES($ZarafaIndexPath);
if ($ZarafaMySQLServiceType == 1 or $ZarafaMySQLServiceType == 2) {
$ARRAY["ZARAFA_DB"] = $unix->DIRSIZE_BYTES("/var/lib/mysql");
}
if ($ZarafaMySQLServiceType == 3) {
$WORKDIR = $sock->GET_INFO("ZarafaDedicateMySQLWorkDir");
if ($WORKDIR == null) {
$WORKDIR = "/home/zarafa-db";
}
$ARRAY["ZARAFA_DB"] = $unix->DIRSIZE_BYTES($WORKDIR);
}
$ARRAY["ATTACHS"] = $unix->DIRSIZE_BYTES($ZarafaStoreOutsidePath);
@file_put_contents($timefile, serialize($ARRAY));
@chmod($timefile, 0750);
unset($ARRAY);
$zarafaadmin = $unix->find_program("zarafa-admin");
$kill = $unix->find_program("kill");
$pids = $unix->PIDOF_PATTERN_ALL("zarafa-admin -l");
if (count($pids) > 0) {
while (list($pid, $line) = each($pids)) {
$time = $unix->PROCESS_TTL($pid);
if ($time > 15) {
$unix->_syslog("killing zarafa-admin -l pid {$pid} ({$time}mn)", basename(__FILE__));
unix_system_kill_force($pid);
}
}
}
$pid = $unix->PIDOF_PATTERN("zarafa-admin -l");
if ($unix->process_exists($pid)) {
$unix->_syslog("zarafa-admin -l pid {$pid} still running", basename(__FILE__));
}
if ($GLOBALS["VERBOSE"]) {
echo "{$zarafaadmin} -l 2>&1\n--------------------------------------------------------------------\n";
}
exec("{$zarafaadmin} -l 2>&1", $results);
while (list($num, $line) = each($results)) {
$line = trim($line);
if ($GLOBALS["VERBOSE"]) {
echo "\"{$line}\"\n";
}
if (preg_match("#User list for\\s+(.+?)\\(#i", $line, $re)) {
$ou = $re[1];
//.........这里部分代码省略.........
示例2: sessions_clean
function sessions_clean()
{
$unix = new unix();
$sock = new sockets();
$TimeFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$APACHE_SRC_ACCOUNT = $unix->APACHE_SRC_ACCOUNT();
$APACHE_SRC_GROUP = $unix->APACHE_SRC_GROUP();
$CleanPHPSessionTime = $sock->GET_INFO("CleanPHPSessionTime");
if (!is_numeric($CleanPHPSessionTime)) {
$CleanPHPSessionTime = 2880;
}
if ($unix->file_time_min($TimeFile) < 60) {
return;
}
@unlink($TimeFile);
@file_put_contents($TimeFile, time());
if ($CleanPHPSessionTime > 5) {
if (is_dir("/var/lib/php5")) {
foreach (glob("/var/lib/php5/*") as $filename) {
$unix->chown_func($APACHE_SRC_ACCOUNT, $APACHE_SRC_GROUP, $filename);
$time = $unix->file_time_min($filename);
if ($time > 2880) {
$unix->_syslog("Clean: Remove PHP Session file " . basename($filename) . " {$time}Mn", basename(__FILE__));
@unlink($filename);
}
}
}
if (is_dir("/var/lib/php5-zarafa")) {
foreach (glob("/var/lib/php5-zarafa/*") as $filename) {
$time = $unix->file_time_min($filename);
if ($time > 2880) {
$unix->_syslog("Clean: Remove PHP Zarafa Session file " . basename($filename) . " {$time}Mn", basename(__FILE__));
@unlink($filename);
}
}
}
}
foreach (glob("/usr/share/artica-postfix/ressources/logs/jGrowl/*") as $filename) {
$time = $unix->file_time_min($filename);
if ($time > 360) {
@unlink($filename);
}
}
foreach (glob("/usr/share/artica-postfix/ressources/conf/*") as $filename) {
$time = $unix->file_time_min($filename);
if ($time > 360) {
@unlink($filename);
}
}
}
示例3: build_ufdbguard_HUP
function build_ufdbguard_HUP()
{
if (isset($GLOBALS["build_ufdbguard_HUP_EXECUTED"])) {
return;
}
$GLOBALS["build_ufdbguard_HUP_EXECUTED"] = true;
$unix = new unix();
$sock = new sockets();
$forceTXT = null;
$ufdbguardReloadTTL = intval($sock->GET_INFO("ufdbguardReloadTTL"));
if ($ufdbguardReloadTTL < 1) {
$ufdbguardReloadTTL = 10;
}
$php5 = $unix->LOCATE_PHP5_BIN();
$rm = $unix->find_program("rm");
shell_exec("{$php5} /usr/share/artica-postfix/exec.ufdbclient.reload.php");
shell_exec("{$rm} /home/squid/error_page_cache/*");
if (function_exists("debug_backtrace")) {
$trace = @debug_backtrace();
if (isset($trace[1])) {
$called = "called by " . basename($trace[1]["file"]) . " {$trace[1]["function"]}() line {$trace[1]["line"]}";
}
}
$trace = debug_backtrace();
if (isset($trace[1])) {
$called = " called by " . basename($trace[1]["file"]) . " {$trace[1]["function"]}() line {$trace[1]["line"]}";
}
$timeFile = "/etc/artica-postfix/pids/UfdbGuardReload.time";
$TimeReload = $unix->file_time_min($timeFile);
if (!$GLOBALS["FORCE"]) {
if ($TimeReload < $ufdbguardReloadTTL) {
build_progress("{reloading_service} {failed}", 110);
$unix->_syslog("Webfiltering service Aborting reload, last reload since {$TimeReload}Mn, need at least {$ufdbguardReloadTTL}Mn", basename(__FILE__));
echo "Starting......: " . date("H:i:s") . " Webfiltering service Aborting reload, last reload since {$TimeReload}Mn, need at least {$ufdbguardReloadTTL}Mn\n";
return;
}
} else {
echo "Starting......: " . date("H:i:s") . " --- FORCED --- ufdbGuard last reload was {$TimeReload}mn\n";
}
@unlink($timeFile);
@file_put_contents($timeFile, time());
$pid = ufdbguard_pid();
build_progress("{reloading_service} {$pid}", 71);
$squidbin = $unix->LOCATE_SQUID_BIN();
$ufdbguardd = $unix->find_program("ufdbguardd");
if (strlen($ufdbguardd) < 5) {
WriteToSyslogMail("ufdbguardd no such binary", basename(__FILE__));
return;
}
$kill = $unix->find_program("kill");
if ($unix->process_exists($pid)) {
$processTTL = intval($unix->PROCCESS_TIME_MIN($pid));
$LastTime = intval($unix->file_time_min($timeFile));
build_progress("{reloading_service} {$pid} {$processTTL}Mn", 72);
echo "Starting......: " . date("H:i:s") . " Webfiltering service Reloading service TTL {$processTTL}Mn\n";
echo "Starting......: " . date("H:i:s") . " Webfiltering service Reloading service Last config since {$LastTime}Mn\n";
echo "Starting......: " . date("H:i:s") . " Webfiltering service Reloading Max reload {$ufdbguardReloadTTL}Mn\n";
if (!$GLOBALS["FORCE"]) {
echo "Starting......: " . date("H:i:s") . " Webfiltering service Reloading force is disabled\n";
if ($LastTime < $ufdbguardReloadTTL) {
squid_admin_mysql(2, "Reloading Web Filtering PID: {$pid} [Aborted] last reload {$LastTime}Mn, need {$ufdbguardReloadTTL}mn", null, __FILE__, __LINE__);
echo "Starting......: " . date("H:i:s") . " Webfiltering service Reloading service Aborting... minimal time was {$ufdbguardReloadTTL}mn - Current {$LastTime}mn\n{$called}\n";
return;
}
if ($processTTL < $ufdbguardReloadTTL) {
squid_admin_mysql(2, "Reloading Web Filtering PID: {$pid} [Aborted] {$processTTL}Mn, need {$ufdbguardReloadTTL}mn", null, __FILE__, __LINE__);
echo "Starting......: " . date("H:i:s") . " Webfiltering service PID: {$pid} Reloading service Aborting... minimal time was {$ufdbguardReloadTTL}mn\n{$called}\n";
return;
}
}
if ($GLOBALS["FORCE"]) {
$forceTXT = " with option FORCE enabled";
$prefix = "[FORCED]:";
}
@unlink($timeFile);
@file_put_contents($timeFile, time());
echo "Starting......: " . date("H:i:s") . " Webfiltering service Reloading service PID:{$pid} {$processTTL}mn\n";
squid_admin_mysql(1, "{$prefix}Reloading Web Filtering service PID: {$pid} TTL {$processTTL}Mn", "{$forceTXT}\n{$called}\n{$GLOBALS["CMDLINEXEC"]}");
build_progress("{reloading_service} HUP {$pid}", 75);
unix_system_HUP($pid);
build_progress("{reloading_proxy_service}", 76);
shell_exec("{$php5} /usr/share/artica-postfix/exec.ufdbclient.reload.php");
$squidbin = $unix->LOCATE_SQUID_BIN();
squid_admin_mysql(1, "{$prefix}Reloading Proxy service", null, __FILE__, __LINE__);
system("{$squidbin} -k reconfigure");
return true;
}
squid_admin_mysql(1, "Warning, Reloading Web Filtering but not running [action=start]", "{$forceTXT}\n{$called}\n{$GLOBALS["CMDLINEXEC"]}");
echo "Starting......: " . date("H:i:s") . " Webfiltering service reloading service no pid is found, Starting service...\n";
@unlink($timeFile);
@file_put_contents($timeFile, time());
build_progress("{starting_service}", 76);
if (!ufdbguard_start()) {
return;
}
echo "Starting......: " . date("H:i:s") . " Webfiltering Service restarting ufdb-tail process\n";
shell_exec("/etc/init.d/ufdb-tail restart");
shell_exec("{$php5} /usr/share/artica-postfix/exec.ufdbclient.reload.php");
squid_admin_mysql(1, "{$prefix}Reloading Proxy service", null, __FILE__, __LINE__);
system("{$squidbin} -k reconfigure");
//.........这里部分代码省略.........
示例4: reload
function reload()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$sock = new sockets();
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
}
return;
}
$timeFile = "/etc/artica-postfix/pids/UfdbGuardReload.time";
$ufdbguardReloadTTL = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/ufdbguardReloadTTL"));
$UfdbReloadBySchedule = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/UfdbReloadBySchedule"));
if (!is_numeric($UfdbReloadBySchedule)) {
$UfdbReloadBySchedule = 1;
}
$TimeReload = $unix->file_time_min($timeFile);
if (!$GLOBALS["FORCE"]) {
if ($ufdbguardReloadTTL < 1) {
$ufdbguardReloadTTL = 10;
}
if ($TimeReload < $ufdbguardReloadTTL) {
$unix->_syslog("{$GLOBALS["TITLENAME"]} Aborting reload, last reload since {$TimeReload}Mn, need at least {$ufdbguardReloadTTL}Mn", basename(__FILE__));
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Aborting reload, last reload since {$TimeReload}Mn, need at least {$ufdbguardReloadTTL}Mn\n";
}
return;
}
if ($UfdbReloadBySchedule == 1) {
if (!$GLOBALS["BYSCHEDULE"]) {
$unix->_syslog("{$GLOBALS["TITLENAME"]} Aborting reload, only allowed trough a schedule", basename(__FILE__));
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Aborting reload, only allowed trough a schedule\n";
}
return;
}
}
}
if ($GLOBALS["FORCE"]) {
$pid = PID_NUM();
$TimeService = $unix->PROCCESS_TIME_MIN($pid);
squid_admin_mysql(1, "Force Webfiltering service Running since {$TimeService}Mn to be reloaded", "last reload since {$TimeReload}Mn", __FILE__, __LINE__);
}
@unlink($timeFile);
@file_put_contents($timeFile, time());
$squid_version = $unix->squid_version();
if (preg_match("#^([0-9]+)\\.([0-9]+)#", $squid_version, $re)) {
if (intval($re[2]) > 4) {
$re[2] = 4;
}
$squid_version = "{$re[1]}.{$re[2]}";
}
$kill = $unix->find_program("kill");
$php5 = $unix->LOCATE_PHP5_BIN();
$verif_Squid_Version = verif_Squid_Version();
if ($verif_Squid_Version != $squid_version) {
squid_admin_mysql(1, "{$verif_Squid_Version}/{$squid_version} reconfiguring for squid compatibility", __FILE__, __LINE__, "global-compile");
$unix->_syslog("{$GLOBALS["TITLENAME"]} {$verif_Squid_Version}/{$squid_version} reconfiguring for squid compatibility", basename(__FILE__));
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} {$verif_Squid_Version}/{$squid_version} reconfiguring for squid compatibility...\n";
}
shell_exec("{$php5} /usr/share/artica-postfix/exec.squidguard.php --build --force");
}
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Squid-Cache version {$squid_version}\n";
}
$pid = PID_NUM();
if ($unix->process_exists($pid)) {
$unix->_syslog("{$GLOBALS["TITLENAME"]} Reloading PID {$pid}\n", basename(__FILE__));
$chmod = $unix->find_program("chmod");
$chown = $unix->find_program("chown");
shell_exec("{$chmod} 0755 /etc/squid3/ufdbGuard.conf");
shell_exec("{$chown} squid:squid /etc/squid3");
shell_exec("{$chown} squid:squid /etc/squid3/ufdbGuard.conf");
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Reloading PID {$pid}\n";
}
shell_exec("{$php5} /usr/share/artica-postfix/exec.squidguard.php --dbmem");
shell_exec("{$php5} /usr/share/artica-postfix/exec.squidguard.php --reload");
shell_exec("{$php5} /usr/share/artica-postfix/exec.ufdbclient.reload.php");
} else {
start(true);
}
}
示例5: reload
function reload()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$sock = new sockets();
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
}
return;
}
$pid = PID_NUM();
if ($unix->process_exists($pid)) {
$unix->_syslog("{$GLOBALS["TITLENAME"]} Reloading PID {$pid}\n", basename(__FILE__));
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Reloading PID {$pid}\n";
}
CheckDirectories();
buildconfig();
unix_system_HUP($pid);
} else {
start(true);
}
}
示例6: reload
function reload()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$sock = new sockets();
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Already Artica task running PID {$pid} since {$time}mn\n";
}
return;
}
$DisableUfdbCat = $sock->DisableUfdbCat();
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} DisableUfdbCat= {$DisableUfdbCat}\n";
}
if ($DisableUfdbCat == 1) {
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} service disabled (see DisableUfdbCat)\n";
}
stop();
return;
}
$pid = PID_NUM();
$time = $unix->PROCCESS_TIME_MIN($pid);
if ($unix->process_exists($pid)) {
CheckDirectories(true);
CheckDirectoriesTLSE();
buildconfig();
$unix->_syslog("{$GLOBALS["TITLENAME"]} Reloading PID {$pid} (running since {$time}Mn)\n", basename(__FILE__));
if ($GLOBALS["OUTPUT"]) {
echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Reloading PID {$pid}\n";
}
squid_admin_mysql(1, "Reloading Categories service (running since {$time}Mn)", null, __FILE__, __LINE__);
unix_system_HUP($pid);
} else {
start(true);
}
}
示例7: trim
$familysite = null;
}
if ($GLOBALS["OUTPUT"]) {
echo "{$www} -> STAMP\n";
}
$q->QUERY_SQL("UPDATE webtests SET checked=1 WHERE sitename='{$ligne["sitename"]}'");
if ($GLOBALS["OUTPUT"]) {
echo "{$www} -> GET_CATEGORIES\n";
}
$articacats = trim($q->GET_CATEGORIES($ligne["sitename"], true, false));
if ($GLOBALS["OUTPUT"]) {
echo "{$ligne["sitename"]} -> \"{$articacats}\"\n";
}
if ($articacats != null) {
$q->categorize($ligne["sitename"], $articacats);
$unix->_syslog("{$percent}) {$ligne["sitename"]} = {$articacats}", __FILE__);
continue;
}
if ($familysite != null) {
$articacats = trim($q->GET_CATEGORIES($familysite, true, false));
if ($GLOBALS["OUTPUT"]) {
echo "{$ligne["sitename"]} {$familysite} -> {$articacats}\n";
}
if ($articacats != null) {
$q->categorize($ligne["sitename"], $articacats);
$unix->_syslog("{$percent}) {$ligne["sitename"]} = {$articacats}", __FILE__);
continue;
}
}
$ipaddr = gethostbyname($ligne["sitename"]);
if (!$IpClass->isIPAddress($ipaddr)) {