• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP system_is_overloaded函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中system_is_overloaded函数的典型用法代码示例。如果您正苦于以下问题:PHP system_is_overloaded函数的具体用法?PHP system_is_overloaded怎么用?PHP system_is_overloaded使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了system_is_overloaded函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: CheckCMDLine

function CheckCMDLine()
{
    $unix = new unix();
    $PID_FILE = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
    $pid = $unix->get_pid_from_file($PID_FILE);
    if ($unix->process_exists($pid)) {
        return;
    }
    @file_put_contents($PID_FILE, getmypid());
    if (system_is_overloaded()) {
        die;
    }
    $sock = new sockets();
    $ips = unserialize(base64_decode($sock->GET_INFO("RBLCheckIPList")));
    if (count($ips) > 0) {
        if ($GLOBALS["VERBOSE"]) {
            echo count($ips) . " elements to check\n";
        }
        if (is_array($ips)) {
            while (list($num, $ip) = each($ips)) {
                if ($GLOBALS["VERBOSE"]) {
                    echo "{$ip} element...\n";
                }
                ChecksDNSBL($ip, false, true);
            }
            ChecksDNSBL();
            return;
        }
    }
    ChecksDNSBL();
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:exec.my-rbl.check.php


示例2: check

function check()
{
    $EnablePhileSight = GET_INFO_DAEMON("EnablePhileSight");
    if ($EnablePhileSight == null) {
        $EnablePhileSight = 0;
    }
    if ($EnablePhileSight == 0) {
        writelogs("feature disabled, aborting...", __FUNCTION__, __FILE__, __LINE__);
        die;
    }
    if (system_is_overloaded()) {
        writelogs("System overloaded, aborting this feature for the moment", __FUNCTION__, __FILE__, __LINE__);
        die;
    }
    @mkdir("/opt/artica/philesight");
    $unix = new unix();
    $min = $unix->file_time_min("/opt/artica/philesight/database.db");
    $sock = new sockets();
    $rr = $sock->GET_INFO("PhileSizeRefreshEach");
    if ($rr == null) {
        $rr = 120;
    }
    if ($rr == "disable") {
        die;
    }
    writelogs("/opt/artica/philesight/database.db = {$min} minutes, {$rr} minutes to run", __FUNCTION__, __FILE__, __LINE__);
    if ($min >= $rr) {
        run();
    }
}
开发者ID:brucewu16899,项目名称:artica,代码行数:30,代码来源:exec.philesight.php


示例3: purge

function purge()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidtime = "/etc/artica-postfix/pids/exec.suricata.hourly.purge.time";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        echo "Starting......: " . date("H:i:s") . " [INIT]: Already Artica task running PID {$pid} since {$time}mn\n";
        return;
    }
    @file_put_contents($pidfile, getmypid());
    if (system_is_overloaded()) {
        return;
    }
    $timeExec = $unix->file_time_min($pidtime);
    if ($timeExec < 1440) {
        return;
    }
    @unlink($pidtime);
    @file_put_contents($pidtime, time());
    $q = new postgres_sql();
    $sock = new sockets();
    $SuricataPurge = intval($sock->GET_INFO("SuricataPurge"));
    if ($SuricataPurge == 0) {
        $SuricataPurge = 15;
    }
    $q->QUERY_SQL("DELETE FROM suricata_events WHERE zdate < NOW() - INTERVAL '{$SuricataPurge} days'");
}
开发者ID:articatech,项目名称:artica,代码行数:29,代码来源:exec.suricata.hourly.php


示例4: detect_kernels

function detect_kernels()
{
    $unix = new unix();
    if (!$GLOBALS["VERBOSE"]) {
        if (is_file("/usr/share/artica-postfix/ressources/logs/kernel.lst")) {
            if ($unix->file_time_min("/usr/share/artica-postfix/ressources/logs/kernel.lst") < 360) {
                die;
            }
        }
    }
    $users = new usersMenus();
    if ($users->LinuxDistriCode != "DEBIAN" && $users->LinuxDistriCode != "UBUNTU") {
        die;
    }
    $unix = new unix();
    $apt_cache = $unix->find_program("apt-cache");
    if ($apt_cache == null) {
        echo "Could not find apt-cache\n";
        die;
    }
    if (system_is_overloaded(basename(__FILE__))) {
        $unix->send_email_events("apt-cache aborted, system is overloaded..", "will restart analyzis in next cycle", "system");
        die;
    }
    echo "{$apt_cache} search linux-image\n";
    exec("{$apt_cache} search linux-image", $results);
    while (list($num, $val) = each($results)) {
        if (preg_match("#linux-image-([0-9\\.]+)-([0-9]+)-(.+?)\\s+-\\s+(.+?)\$#", $val, $re)) {
            $array["DPKG"][] = array("VERSION" => $re[1], "BUILD" => $re[2], "ARCH" => $re[3], "INFOS" => $re[4], "PACKAGE" => "linux-image-{$re[1]}-{$re[2]}-{$re[3]}", "FULL_VERSION" => "{$re[1]}-{$re[2]}-{$re[3]}");
        }
    }
    $array["INFOS"] = CpuFamilyInfos();
    @file_put_contents("/usr/share/artica-postfix/ressources/logs/kernel.lst", base64_encode(serialize($array)));
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:34,代码来源:exec.apt-cache.kernel.php


示例5: importActivedirectoryusers

function importActivedirectoryusers()
{
    $sock = new sockets();
    $EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth");
    if (!is_numeric($EnableKerbAuth)) {
        $EnableKerbAuth = 0;
    }
    if ($EnableKerbAuth == 0) {
        return;
    }
    $unix = new unix();
    $user = new settings_inc();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
    $pidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        WriteMyLogs("Process {$pid} already exists", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    if (system_is_overloaded(basename(__FILE__))) {
        WriteMyLogs("Overloaded system, aborting", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    @file_put_contents($pidfile, getmypid());
    $TImeStamp = $unix->file_time_min($pidTime);
    if (!$GLOBALS["FORCE"]) {
        if ($TImeStamp < 20) {
            WriteMyLogs("Need 20mn, current={$TImeStamp}Mn executed by:{$GLOBALS["EXECUTOR"]} Params:{$GLOBALS["PARAMS"]}", __FUNCTION__, __FILE__, __LINE__);
            return;
        }
    }
    @unlink($pidTime);
    @file_put_contents($pidTime, time());
    $netbin = $unix->LOCATE_NET_BIN_PATH();
    $usermod = $unix->find_program("usermod");
    $chmod = $unix->find_program("chmod");
    if (!is_file($netbin)) {
        WriteMyLogs("net no such binary, aborting", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    if (is_dir("/var/run/samba/winbindd_privileged")) {
        shell_exec("{$usermod} -G winbindd_priv squid >/dev/null 2>&1");
        shell_exec("{$chmod} 0750 /var/run/samba/winbindd_privileged/ >/dev/null 2>&1");
    }
    $array = unserialize(base64_decode($sock->GET_INFO("KerbAuthInfos")));
    $domainUp = strtoupper($array["WINDOWS_DNS_SUFFIX"]);
    $domain_lower = strtolower($array["WINDOWS_DNS_SUFFIX"]);
    $adminpassword = $array["WINDOWS_SERVER_PASS"];
    $adminpassword = $unix->shellEscapeChars($adminpassword);
    $adminname = $array["WINDOWS_SERVER_ADMIN"];
    $ad_server = $array["WINDOWS_SERVER_NETBIOSNAME"];
    $GLOBALS["AUTHCMD"] = " -U {$adminname}%{$adminpassword}";
    getNetInfos();
    if (!isset($GLOBALS["LDAP_HOST"])) {
        WriteMyLogs("Unable to get ldap infos, aborting", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    GetUsersArray();
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:59,代码来源:exec.squid.ad.import.php


示例6: start_hour

function start_hour()
{
    $TimeFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
    $unix = new unix();
    $sock = new sockets();
    if (system_is_overloaded(basename(__FILE__))) {
        return;
    }
    $pid = @file_get_contents($pidfile);
    if ($pid < 100) {
        $pid = null;
    }
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $timepid = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["VERBOSE"]) {
            echo "{$pid} already executed since {$timepid}Mn\n";
        }
        if (!$GLOBALS["FORCE"]) {
            if ($timepid < 14) {
                return;
            }
            $kill = $unix->find_program("kill");
            unix_system_kill_force($pid);
        }
    }
    @unlink($TimeFile);
    @file_put_contents($TimeFile, time());
    $hostname = $unix->hostname_g();
    $today = date("Y-m-d") . " 00:00:00";
    $postgres = new postgres_sql();
    $results = $postgres->QUERY_SQL("select date_trunc('H',zdate) + (round(extract('minute' from zdate)/15)*15) * '1 minute'::interval as time, sum(rx) as rx, sum(tx) as tx,eth from access_log WHERE proxyname='{$hostname}' AND zdate >'{$today}' group by time,eth");
    $c = 0;
    $f = array();
    while ($ligne = @pg_fetch_assoc($results)) {
        $time = $ligne["time"];
        $ETH = $ligne["eth"];
        if ($ETH == "lo") {
            continue;
        }
        $RX = $ligne["rx"];
        $TX = $ligne["tx"];
        $f[] = "('{$time}','{$ETH}','{$RX}','{$TX}')";
    }
    if (count($f) == 0) {
        return;
    }
    $q = new mysql();
    if ($q->TABLE_EXISTS("RXTX_HOUR", "artica_events")) {
        $q->QUERY_SQL("TRUNCATE TABLE `RXTX_HOUR`", "artica_events");
    }
    $sql = "CREATE TABLE IF NOT EXISTS `RXTX_HOUR`\n\t(`ZDATE` DATETIME,\n\t`RX` INT UNSIGNED NOT NULL DEFAULT 1,\n\t`TX` INT UNSIGNED NOT NULL DEFAULT 1,\n\t`ETH` VARCHAR(60),\n\tKEY `ZDATE`(`ZDATE`),\n\tKEY `RX`(`RX`),\n\tKEY `TX`(`TX`),\n\tKEY `ETH`(`ETH`) )  ENGINE = MYISAM;";
    $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        return;
    }
    $q->QUERY_SQL("INSERT IGNORE INTO RXTX_HOUR (ZDATE,ETH,RX,TX) VALUES " . @implode(",", $f), "artica_events");
    start_week();
}
开发者ID:articatech,项目名称:artica,代码行数:59,代码来源:exec.rxtx.hourly.php


示例7: parse_logs

function parse_logs()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if (!$GLOBALS["VERBOSE"]) {
        if ($unix->file_time_min($pidTime) < 45) {
            return;
        }
    }
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        return;
    }
    @file_put_contents($pidfile, getmypid());
    @unlink($pidTime);
    @file_put_contents($pidTime, time());
    $sock = new sockets();
    $EnableNginxStats = $sock->GET_INFO("EnableNginxStats");
    if (!is_numeric($EnableNginxStats)) {
        $EnableNginxStats = 0;
    }
    if ($EnableNginxStats == 0) {
        return;
    }
    if (system_is_overloaded(basename(__FILE__))) {
        events("Overloaded system: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]} aborting", __FUNCTION__, __LINE__);
        return;
    }
    $nice = EXEC_NICE();
    $sock = new sockets();
    $kill = $unix->find_program("kill");
    $NginxWorkLogsDir = $sock->GET_INFO("NginxWorkLogsDir");
    if ($NginxWorkLogsDir == null) {
        $NginxWorkLogsDir = "/home/nginx/logsWork";
    }
    $sys = new mysql_storelogs();
    $files = $unix->DirFiles($NginxWorkLogsDir, "-([0-9\\-]+)\\.log");
    while (list($filename, $line) = each($files)) {
        if (!preg_match("#^(.+?)-[0-9]+-[0-9]+-[0-9]+-[0-9]+\\.log\$#", $filename, $re)) {
            if ($GLOBALS["VERBOSE"]) {
                echo "{$filename}, skip\n";
            }
            continue;
        }
        $servername = $re[1];
        $fullpath = "{$NginxWorkLogsDir}/{$filename}";
        ParseFile($servername, $fullpath);
    }
    $php = $unix->LOCATE_PHP5_BIN();
    $nohup = $unix->find_program("nohup");
    shell_exec("{$nohup} {$php} " . __FILE__ . " --hosts >/dev/null 2>&1 &");
    shell_exec("{$nohup} {$php} " . dirname(__FILE__) . "/exec.nginx-stats-day.php >/dev/null 2>&1 &");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:55,代码来源:exec.nginx-stats.php


示例8: ScanFoldders

function ScanFoldders()
{
    $sock = new sockets();
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pid = file_get_contents("{$pidfile}");
    if ($GLOBALS["VERBOSE"]) {
        echo "{$timefile}\n";
    }
    if (system_is_overloaded(basename(__FILE__))) {
        die;
    }
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $timeMin = $unix->PROCCESS_TIME_MIN($pid);
        if ($timeMin > 240) {
            system_admin_events("Too many TTL, {$pid} will be killed", __FUNCTION__, __FILE__, __LINE__, "logrotate");
            $kill = $unix->find_program("kill");
            unix_system_kill_force($pid);
        } else {
            die;
        }
    }
    if (!$GLOBALS["FORCE"]) {
        $TimeExec = $unix->file_time_min($timefile);
        if ($TimeExec < 240) {
            return;
        }
    }
    @unlink($timefile);
    @file_put_contents($timefile, time());
    $LogRotatePath = $sock->GET_INFO("LogRotatePath");
    $SystemLogsPath = $sock->GET_INFO("SystemLogsPath");
    $BackupMaxDaysDir = $sock->GET_INFO("BackupMaxDaysDir");
    $maillogStoragePath = trim(@file_get_contents("/etc/artica-postfix/settings/Daemons/maillogStoragePath"));
    if ($GLOBALS["VERBOSE"]) {
        echo "Starting Main\n";
    }
    $q = new mysql();
    $q->QUERY_SQL("DROP TABLE `sysstorestatus`", "artica_events");
    $sql = "CREATE TABLE IF NOT EXISTS `sysstorestatus` (\n\t\t\t  `filepath` VARCHAR(255) NOT NULL,\n\t\t\t  `filesize`  BIGINT UNSIGNED NOT NULL,\n\t\t\t  `zDate` DATETIME,\n\t\t\t  PRIMARY KEY (`filepath`),\n\t\t\t  KEY `zDate` (`zDate`),\n\t\t\t  KEY `filesize` (`filesize`)\n\t\t\n\t\t\t)";
    $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
    ScanThis("/home/postfix/maillog");
    ScanThis("/home/logrotate");
    ScanThis("/home/logrotate_backup");
    ScanThis("/home/logs-backup");
    ScanThis("/home/backup/postfix");
    ScanThis($LogRotatePath);
    ScanThis($SystemLogsPath);
    ScanThis($maillogStoragePath);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:55,代码来源:exec.scan.storage-logs.php


示例9: update

function update()
{
    if (system_is_overloaded()) {
        return;
    }
    $unix = new unix();
    $sock = new sockets();
    $pidfile = "/etc/artica-postfix/pids/exec.ipblock.php.update.pid";
    $pidtime = "/etc/artica-postfix/pids/exec.ipblock.php.update.time";
    $pid = @file_get_contents($pidfile);
    if (!$GLOBALS["FORCE"]) {
        if ($unix->process_exists($pid)) {
            echo "Already running pid {$pid}\n";
            return;
        }
    }
    include_once dirname(__FILE__) . '/ressources/class.ccurl.inc';
    if (!is_file($pidtime)) {
        @file_put_contents($pidtime, time());
    }
    if (!$GLOBALS["FORCE"]) {
        if ($unix->file_time_min($pidtime) > 720) {
            @unlink($pidtime);
            @file_put_contents($pidtime, time());
            return;
        }
    }
    @file_put_contents($pidfile, getmypid());
    $EnableIpBlocks = intval($sock->GET_INFO("EnableIpBlocks"));
    if ($EnableIpBlocks == 0) {
        return;
    }
    $DIR_TEMP = $unix->TEMP_DIR();
    $curl = new ccurl("http://www.ipdeny.com/ipblocks/data/countries/all-zones.tar.gz");
    if (!$curl->GetFile("{$DIR_TEMP}/all-zones.tar.gz")) {
        system_admin_events(0, "Fatal, Unable to download all-zones.tar.gz from ipdeny.com", __FILE__, __LINE__);
        return;
    }
    $OldMd5 = $sock->GET_INFO("IpBlocksMD5");
    $md5File = md5_file("{$DIR_TEMP}/all-zones.tar.gz");
    if ($md5File == $OldMd5) {
        ipblocks();
        return;
    }
    $tar = $unix->find_program("tar");
    @mkdir("/home/artica/ipblocks", 0755, true);
    shell_exec("{$tar} xf {$DIR_TEMP}/all-zones.tar.gz -C  /home/artica/ipblocks/");
    if (ipblocks()) {
        $sock->SET_INFO("IpBlocksMD5", "{$md5File}");
        system_admin_events(0, "Restarting Firewall in order to refresh countries blocking");
    }
}
开发者ID:articatech,项目名称:artica,代码行数:52,代码来源:exec.ipblock.php


示例10: scan

function scan()
{
    if (system_is_overloaded(basename(__FILE__))) {
        apache_admin_mysql(0, "Overloaded system, retry next time....", null, __FILE__, __LINE__);
        return;
    }
    $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $unix = new unix();
    $pid = $unix->get_pid_from_file($pidFile);
    if ($unix->process_exists($pid)) {
        events("A process, {$pid} Already exists...");
        return;
    }
    $GLOBALS["MYHOSTNAME_PROXY"] = $unix->hostname_g();
    @file_put_contents($pidFile, getmypid());
    $time = $unix->file_time_min($pidtime);
    if (!$GLOBALS["VERBOSE"]) {
        if ($time < 5) {
            events("{$time}mn, require minimal 5mn");
            return;
        }
    }
    $q = new mysql_squid_builder();
    $q->QUERY_SQL("CREATE TABLE IF NOT EXISTS `dashboard_apache_sizes` ( `TIME` DATETIME,\n\t\t\t`zmd5` VARCHAR(90) NOT NULL PRIMARY KEY,\n\t\t\t`SITENAME` VARCHAR(128),\n\t\t\t`SIZE` BIGINT UNSIGNED, `RQS` BIGINT UNSIGNED,\n\t\t\tKEY `TIME` (`TIME`),\n\t\t\tKEY `SIZE` (`SIZE`),\n\t\t\tKEY `RQS` (`RQS`)\n\t\t\t) ENGINE=MYISAM;");
    if (!$q->ok) {
        apache_admin_mysql(0, "Fatal MySQL error", $q->mysql_error, __FILE__, __LINE__);
        return;
    }
    if (!is_file("/home/apache/artica-stats/requests.log")) {
        echo "/home/apache/artica-stats/requests.log no such file...\n";
        return;
    }
    @mkdir("/home/apache/artica-stats/works", 0755, true);
    if (is_file("/home/apache/artica-stats/works/apache.log")) {
        echo "Parse /home/apache/artica-stats/works/apache.log\n";
        Parse("/home/apache/artica-stats/works/apache.log");
        return;
    }
    if (!@copy("/home/apache/artica-stats/requests.log", "/home/apache/artica-stats/works/apache.log")) {
        echo "Copy failed\n";
        return;
    }
    if (!is_file("/home/apache/artica-stats/works/apache.log")) {
        echo "/home/apache/artica-stats/works/apache.log no such file...\n";
        return;
    }
    @unlink("/home/apache/artica-stats/requests.log");
    echo "Parse /home/apache/artica-stats/works/apache.log\n";
    Parse("/home/apache/artica-stats/works/apache.log");
    CLEAN_MYSQL();
}
开发者ID:articatech,项目名称:artica,代码行数:52,代码来源:exec.apache.hour.php


示例11: launch_tests

function launch_tests()
{
    $unix = new unix();
    $php = $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__))) {
        return;
    }
    if (system_is_overloaded(basename(__FILE__))) {
        system_admin_events("Overloaded, aborting task...", __FUNCTION__, __FILE__, __LINE__, "system");
        $unix->THREAD_COMMAND_SET("{$php} " . __FILE__);
        return;
    }
    @file_put_contents($pidfile, getmypid());
    $datafile = "/etc/artica-postfix/settings/Daemons/HdparmInfos";
    writelogs("Testing hard drives ({$datafile})", __FUNCTION__, __FILE__, __LINE__);
    $timenum = file_time_min($datafile);
    if (is_file($datafile)) {
        if (file_time_min($datafile) < 61) {
            writelogs("{$timenum}Mn executed, waiting 60Mn", __FUNCTION__, __FILE__, __LINE__);
            die;
        }
    }
    if ($GLOBALS["FIND_HDPARM"] == null) {
        writelogs("Unable to stat 'hdparm'", __FUNCTION__, __FILE__, __LINE__);
        die;
    }
    $disks = GetDisks();
    if (!is_array($disks)) {
        return null;
    }
    while (list($index, $line) = each($disks)) {
        unset($results);
        exec("{$GLOBALS["FIND_HDPARM"]} -t {$index}", $results);
        while (list($num, $line_result) = each($results)) {
            if (preg_match("#=\\s+([0-9\\.]+)\\s+MB\\/sec\$#", $line_result, $re)) {
                if (preg_match("#.+?\\/(.+)\$#", $index, $ri)) {
                    system_admin_events("{$ri[1]}:{$re[1]}MB/sec", __FUNCTION__, __FILE__, __LINE__, "system");
                    writelogs("testing disk {$ri[1]}:{$re[1]}MB/sec...", __FUNCTION__, __FILE__, __LINE__);
                    $array[$ri[1]] = $re[1];
                }
            }
        }
    }
    @unlink($datafile);
    @file_put_contents($datafile, base64_encode(serialize($array)));
    if (!is_file($datafile)) {
        writelogs("{$datafile} no such file or directory", __FUNCTION__, __FILE__, __LINE__);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:51,代码来源:exec.hdparm.php


示例12: parseQueue

function parseQueue()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = $unix->get_pid_from_file($pidfile);
    $sock = new sockets();
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $pidTime = $unix->PROCCESS_TIME_MIN($pid);
        events("Already process PID: {$pid} running since {$pidTime} minutes", __FUNCTION__, __FILE__, __LINE__, "postfix-stats");
        return;
    }
    @file_put_contents($pidfile, getmypid());
    if (system_is_overloaded(basename(__FILE__))) {
        events("Overloaded system, aborting", __FUNCTION__, __FILE__, __LINE__, "postfix-stats");
        return;
    }
    $EnableArticaSMTPStatistics = $sock->GET_INFO("EnableArticaSMTPStatistics");
    if (!is_numeric($EnableArticaSMTPStatistics)) {
        $EnableArticaSMTPStatistics = 0;
    }
    $directory = "/var/log/artica-mail";
    if (!is_dir($directory)) {
        return;
    }
    if (!($handle = @opendir($directory))) {
        return;
    }
    $q = new mysql_postfix_builder();
    $q->CheckTables();
    events("open {$directory}");
    while (false !== ($filename = readdir($handle))) {
        if ($EnableArticaSMTPStatistics == 0) {
            @unlink("{$directory}/{$filename}");
            continue;
        }
        if (!preg_match("#(.+?)\\.[0-9]+\\.aws#", $filename, $re)) {
            continue;
        }
        $instancename = $re[1];
        ParseFile("{$directory}/{$filename}");
        if (system_is_overloaded(basename(__FILE__))) {
            system_admin_events("Overloaded system, aborting", __FUNCTION__, __FILE__, __LINE__, "postfix-stats");
            return;
        }
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:46,代码来源:exec.postfix.parse.awstats.php


示例13: parse_hours

function parse_hours()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if (!$GLOBALS["VERBOSE"]) {
        if ($unix->file_time_min($pidTime) < 60) {
            return;
        }
    }
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        return;
    }
    @file_put_contents($pidfile, getmypid());
    @unlink($pidTime);
    @file_put_contents($pidTime, time());
    $sock = new sockets();
    $EnableNginxStats = $sock->GET_INFO("EnableNginxStats");
    if (!is_numeric($EnableNginxStats)) {
        $EnableNginxStats = 0;
    }
    if ($EnableNginxStats == 0) {
        return;
    }
    if (system_is_overloaded(basename(__FILE__))) {
        events("Overloaded system: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]} aborting", __FUNCTION__, __LINE__);
        return;
    }
    $FALSES["information_schema"] = true;
    $FALSES["mysql"] = true;
    $q = new nginx_stats();
    $DATABASE_LIST_SIMPLE = $q->DATABASE_LIST_SIMPLE();
    while (list($db, $b) = each($DATABASE_LIST_SIMPLE)) {
        if (isset($FALSES[$db])) {
            continue;
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "Parsing database {$db}\n";
        }
        parse_database($db);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:44,代码来源:exec.nginx-stats-day.php


示例14: start

function start()
{
    // /etc/artica-postfix/pids/exec.loadavg.php.start.time
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidfileTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "{$pidfileTime}\n";
    }
    if (!$GLOBALS["VERBOSE"]) {
        if ($unix->file_time_min($pidfileTime) < 59) {
            return;
        }
    }
    $pid = @file_get_contents($pidfile);
    if ($pid < 100) {
        $pid = null;
    }
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $timepid = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["VERBOSE"]) {
            echo "{$pid} already executed since {$timepid}Mn\n";
        }
        if ($timepid < 15) {
            return;
        }
        $kill = $unix->find_program("kill");
        unix_system_kill_force($pid);
    }
    @file_put_contents($pidfile, getmypid());
    if (system_is_overloaded()) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Overloaded\n";
        }
        die;
    }
    @unlink($pidfileTime);
    @file_put_contents($pidfileTime, time());
    if ($GLOBALS["VERBOSE"]) {
        echo "cpustats\n";
    }
    cpustats();
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:43,代码来源:exec.loadavg.php


示例15: tables_hours

function tables_hours()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "timefile={$timefile}\n";
    }
    $pid = @file_get_contents($pidfile);
    if (!$GLOBALS["FORCE"]) {
        if ($pid < 100) {
            $pid = null;
        }
        $unix = new unix();
        if ($unix->process_exists($pid, basename(__FILE__))) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Already executed pid {$pid}\n";
            }
            return;
        }
        $timeexec = $unix->file_time_min($timefile);
        if ($timeexec < 60) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Only each 60mn - current {$timeexec}mn, use --force to bypass\n";
            }
            return;
        }
        $mypid = getmypid();
        @file_put_contents($pidfile, $mypid);
    }
    @unlink($timefile);
    @file_put_contents($timefile, time());
    $sock = new sockets();
    $GLOBALS["Q"] = new mysql_squid_builder();
    $prefix = date("YmdH");
    $currenttable = "ngixattck_{$prefix}";
    if ($GLOBALS["VERBOSE"]) {
        echo "Current Table: {$currenttable}\n";
    }
    $tablesBrutes = $GLOBALS["Q"]->LIST_TABLES_NGINX_BLOCKED_RT();
    while (list($tablename, $none) = each($tablesBrutes)) {
        if ($tablename == $currenttable) {
            if ($GLOBALS["VERBOSE"]) {
                echo "Skip table: {$tablename}\n";
            }
            continue;
        }
        $t = time();
        if ($GLOBALS["VERBOSE"]) {
            echo "_table_hours_perform({$tablename})\n";
        }
        if (_table_hours_perform($tablename)) {
            $took = $unix->distanceOfTimeInWords($t, time());
            if ($GLOBALS["VERBOSE"]) {
                echo "Remove table: {$tablename}\n";
            }
            $GLOBALS["Q"]->QUERY_SQL("DROP TABLE `{$tablename}`");
            if (system_is_overloaded()) {
                ufdbguard_admin_events("Fatal: Overloaded system: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]} sleeping stopping function", __FUNCTION__, __FILE__, __LINE__, "stats");
                return true;
            }
        }
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:64,代码来源:exec.nginx.stats.hours.php


示例16: repair_corrupted

    repair_corrupted();
    die;
}
if ($argv[1] == "--clean-tmd") {
    clean_tmd();
    die;
}
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".MAIN.pid";
$pidfileTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".MAIN.pid.time";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
    system_admin_events("Already process {$pid} exists", __FUNCTION__, __FILE__, __LINE__, "clean");
    die;
}
if (system_is_overloaded()) {
    system_admin_events("Overloaded system, aborting task", __FUNCTION__, __FILE__, __LINE__, "clean");
}
$t = time();
system_admin_events("Starting cleaning ipband table...", __FUNCTION__, __FILE__, __LINE__, "clean");
ipband_clean();
system_admin_events("Starting cleaning events table...", __FUNCTION__, __FILE__, __LINE__, "clean");
CleanEvents();
system_admin_events("Starting cleaning maillog table...", __FUNCTION__, __FILE__, __LINE__, "clean");
clean_maillogs();
system_admin_events("Starting cleaning squid statistics table...", __FUNCTION__, __FILE__, __LINE__, "clean");
clean_squid_stats_dbs();
clean_squid_stats_no_items();
$took = $unix->distanceOfTimeInWords($t, time(), true);
system_admin_events("Finish, took {$took}", __FUNCTION__, __FILE__, __LINE__, "clean");
function ipband_clean()
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:exec.mysql.clean.php


示例17: dirname

include_once dirname(__FILE__) . '/framework/class.unix.inc';
include_once dirname(__FILE__) . '/ressources/class.http.pear.inc';
include_once dirname(__FILE__) . '/ressources/class.artica-meta.inc';
include_once dirname(__FILE__) . '/ressources/class.os.system.inc';
include_once dirname(__FILE__) . '/ressources/class.system.network.inc';
include_once dirname(__FILE__) . '/ressources/class.squid.inc';
if (posix_getuid() != 0) {
    die("Cannot be used in web server mode\n\n");
}
if (preg_match("#--verbose#", implode(" ", $argv))) {
    $GLOBALS["VERBOSE"] = true;
}
if (preg_match("#--force#", implode(" ", $argv))) {
    $GLOBALS["FORCE"] = true;
}
if (system_is_overloaded(basename(__FILE__))) {
    echo "Overloaded, die()";
    die;
}
$GLOBALS["MAXTTL"] = 15;
if ($argv[1] == "--register") {
    register();
    exit;
}
if ($argv[1] == "--register-server") {
    register_server();
    exit;
}
if ($argv[1] == "--join") {
    register_server();
    exit;
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:exec.artica.meta.php


示例18: xtart

function xtart()
{
    if (!isset($GLOBALS["ARTICALOGDIR"])) {
        $GLOBALS["ARTICALOGDIR"] = @file_get_contents("/etc/artica-postfix/settings/Daemons/ArticaLogDir");
        if ($GLOBALS["ARTICALOGDIR"] == null) {
            $GLOBALS["ARTICALOGDIR"] = "/var/log/artica-postfix";
        }
    }
    $unix = new unix();
    $binfile = "/usr/share/artica-postfix/bin/seeker";
    if (!is_file($binfile)) {
        build_progress("{failed}", 110);
        events("Unable to stat {$binfile}");
        return;
    }
    $php = $unix->LOCATE_PHP5_BIN();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidTime = "/etc/artica-postfix/pids/exec.seeker.php.xtart.time";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        events("Already process executed pid {$pid}");
        return;
    }
    if (system_is_overloaded(basename(__FILE__))) {
        events("Overloaded system, schedule it later", __LINE__);
        $unix->THREAD_COMMAND_SET("{$php} " . __FILE__);
        build_progress("{failed} Overloaded", 110);
        return;
    }
    @file_put_contents($pidfile, getmypid());
    $timefile = $unix->file_time_min($pidTime);
    $DisksBenchs = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/DisksBenchs"));
    $DisksBenchs = $DisksBenchs * 60;
    if (!$GLOBALS["FORCE"]) {
        if ($timefile < $DisksBenchs) {
            events("{$timefile}mn, require at least {$DisksBenchs}mn", __LINE__);
            return;
        }
    }
    @unlink($pidTime);
    @file_put_contents($pidTime, time());
    build_progress("{scanning} {disks}", 10);
    $fdisk = $unix->find_program("fdisk");
    exec("{$fdisk} -l 2>&1", $results);
    $DISKS = array();
    while (list($index, $line) = each($results)) {
        $line = trim($line);
        if ($line == null) {
            continue;
        }
        if (preg_match("#^(Disque|Disk)\\s+\\/([a-zA-Z0-9\\-\\_\\/\\.]+).*?:\\s+[0-9]+.*?(bytes|octets)#", $line, $re)) {
            $DISKS["/" . $re[2]] = true;
        }
    }
    if (count($DISKS) == 0) {
        build_progress("{scanning} {disks} {failed}", 110);
        events("Unable to detect disks");
        $unix->ToSyslog("Unable to detect disks");
        system_admin_events("Unable to detect disks\n" . @implode("\n", $results), __FUNCTION__, __FILE__, __LINE__, "system");
        return;
    }
    $RUN = false;
    while (list($disk, $line) = each($DISKS)) {
        $results = array();
        @chmod("{$binfile}", 0755);
        $cmd = "{$binfile} \"" . trim($disk) . "\" 2>&1";
        build_progress("{scanning} {$disk}", 60);
        events("{$cmd}");
        exec($cmd, $results);
        while (list($index, $line) = each($results)) {
            $line = trim($line);
            echo "***: {$line}\n";
            $md5 = md5("{$disk}" . time());
            if ($line == null) {
                continue;
            }
            if (!preg_match("#^Results:\\s+([0-9]+)\\s+seeks.*?,\\s+([0-9\\.]+)\\s+ms#", $line, $re)) {
                continue;
            }
            $seeks = $re[1];
            $ms = $re[2];
            events("{$disk} {$seeks} seeks, {$ms} ms", __LINE__);
            $array = array();
            @mkdir("{$GLOBALS["ARTICALOGDIR"]}/seeker-queue", 0755, true);
            $array["SEEKS"] = $seeks;
            $array["DISK"] = $disk;
            $array["MS"] = $ms;
            $array["time"] = time();
            $unix->ToSyslog("Bench disk {$disk} {$ms} ms for {$seeks} seeks");
            events("{$GLOBALS["ARTICALOGDIR"]}/seeker-queue/{$md5}.ay", __LINE__);
            @file_put_contents("{$GLOBALS["ARTICALOGDIR"]}/seeker-queue/{$md5}.ay", serialize($array));
            $RUN = true;
            break;
        }
    }
    if ($RUN) {
        $php = $unix->LOCATE_PHP5_BIN();
        $nohup = $unix->find_program("nohup");
        build_progress("{analyze}", 90);
        $cmd = "{$php} " . dirname(__FILE__) . "/exec.syslog-engine.php --seeker";
//.........这里部分代码省略.........
开发者ID:articatech,项目名称:artica,代码行数:101,代码来源:exec.seeker.php


示例19: postqueue

function postqueue()
{
    $unix = new unix();
    if (!$GLOBALS["FORCE"]) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $pid = @file_get_contents($pidfile);
        if ($unix->process_exists($pid)) {
            echo __FUNCTION__ . " already executed pid {$pid}\n";
            return;
        }
        @file_put_contents($pidfile, getmypid());
    }
    if (system_is_overloaded()) {
        return;
    }
    $DirPath = "{$GLOBALS["ARTICALOGDIR"]}/postqueue";
    if (!($handle = opendir($DirPath))) {
        if ($GLOBALS["VERBOSE"]) {
            echo "{$DirPath} ERROR\n";
        }
        return;
    }
    $c = 0;
    while (false !== ($file = readdir($handle))) {
        if ($file == ".") {
            continue;
        }
        if ($file == "..") {
            continue;
        }
        if (is_dir("{$DirPath}/{$file}")) {
            if ($GLOBALS["VERBOSE"]) {
                echo "{$DirPath}/{$file} -> DIR\n";
            }
            continue;
        }
        $filename = 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP system_log函数代码示例发布时间:2022-05-23
下一篇:
PHP system_hosts_generate函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap