当前位置: 首页>>代码示例>>PHP>>正文


PHP unix::PROCCESS_TIME_MIN方法代码示例

本文整理汇总了PHP中unix::PROCCESS_TIME_MIN方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::PROCCESS_TIME_MIN方法的具体用法?PHP unix::PROCCESS_TIME_MIN怎么用?PHP unix::PROCCESS_TIME_MIN使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unix的用法示例。


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

示例1: start

function start()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $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;
    }
    @file_put_contents($pidfile, getmypid());
    $PID = GET_PID();
    if ($unix->process_exists($PID)) {
        squid_admin_mysql(1, "Watchdog says that rsyslog is off, but exists [action=stamp-pid]", null, __FILE__, __LINE__);
        $SrcPid = intval(@file_get_contents("/var/run/rsyslogd.pid"));
        if ($SrcPid != $PID) {
            squid_admin_mysql(2, "Watchdog says that rsyslog is off (PID:{$SrcPid}), but exists (PID:{$PID}) [action=stamp-pid]", null, __FILE__, __LINE__);
            @file_put_contents("/var/run/rsyslogd.pid", $PID);
        } else {
            squid_admin_mysql(2, "Watchdog says that rsyslog is off (PID:{$SrcPid}), but exists [action=nothing]", null, __FILE__, __LINE__);
        }
        @unlink($pidfile);
        die(1);
    }
    squid_admin_mysql(0, "Syslog daemon is down [action=start]", null, __FILE__, __LINE__);
    system("/etc/init.d/rsyslog start");
    $squid = $unix->LOCATE_SQUID_BIN();
    if (is_file($squid)) {
        sleep(3);
        squid_admin_mysql(1, "Reloading proxy service after starting syslog daemon", null, __FILE__, __LINE__);
        system("{$squid} -f /etc/squid3/squid.conf -k reconfigure");
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:35,代码来源:exec.watchdog.rsyslogd.php

示例2: 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

示例3: checkProcess1

function checkProcess1(){
	
	$unix=new unix();
	$pid=$unix->PIDOF_PATTERN("bin/process1");
	if($pid<5){return null;}
	$process1=$unix->PROCCESS_TIME_MIN($pid);
	$mem=$unix->PROCESS_MEMORY($pid);
	Myevents("process1: $pid ($process1 mn) memory:$mem Mb",__FUNCTION__);
	
	if($mem>30){
		@copy("/var/log/artica-postfix/process1.debug","/var/log/artica-postfix/process1.killed".time().".debug");
		system("/bin/kill -9 $pid");
		$unix->send_email_events(
		"artica process1 (process1) Killed",
		"Process1 use too much memory $mem MB","watchdog"); 		
	}
	
	if($process1>2){
		@copy("/var/log/artica-postfix/process1.debug","/var/log/artica-postfix/process1.killed".time().".debug");
		system("/bin/kill -9 $pid");
		$unix->send_email_events(
		"artica process1 (process1) Killed",
		"Process1 run since $process1 Pid: $pid and exceed 2 minutes live","watchdog"); 
	}

}
开发者ID:rsd,项目名称:artica-1.5,代码行数:26,代码来源:exec.watchdog.php

示例4: scan_connections

function scan_connections()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pid = $unix->get_pid_from_file($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["OUTPUT"]) {
            echo "Artica Task Already running PID {$pid} since {$time}mn\n";
        }
        return;
    }
    @file_put_contents($pidfile, getmypid());
    if (system_is_overloaded()) {
        system_admin_events("Overloaded system, aborting task", __FUNCTION__, __FILE__, __LINE__);
        return false;
    }
    $q = new mysql();
    $sql = "SELECT * FROM texttoldap";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (mysql_num_rows($results) == 0) {
        return;
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        if (!connect($ligne)) {
            continue;
        }
        import($ligne);
        $ID = $ligne["ID"];
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:exec.TextToLdap.php

示例5: parse

function parse()
{
    $TimeFile = "/etc/artica-postfix/pids/exec.squid.stats.mime.proto.php.time";
    $pidfile = "/etc/artica-postfix/pids/exec.squid.stats.mime.proto.php.pid";
    $GLOBALS["LogFileDeamonLogDir"] = @file_get_contents("/etc/artica-postfix/settings/Daemons/LogFileDeamonLogDir");
    if ($GLOBALS["LogFileDeamonLogDir"] == null) {
        $GLOBALS["LogFileDeamonLogDir"] = "/home/artica/squid/realtime-events";
    }
    $unix = new unix();
    $pid = $unix->get_pid_from_file($pidfile);
    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 < 14) {
            return;
        }
        $kill = $unix->find_program("kill");
        unix_system_kill_force($pid);
    }
    @file_put_contents($pidfile, getmypid());
    $TimeExec = $unix->file_time_min($TimeFile);
    if (!$GLOBALS["FORCE"]) {
        if ($TimeExec < 20) {
            return;
        }
    }
    @unlink($TimeFile);
    @file_put_contents($TimeFile, time());
    parsedb("/var/log/squid");
    parsedb($GLOBALS["LogFileDeamonLogDir"]);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:33,代码来源:exec.squid.stats.proto.parser.php

示例6: xstart

function xstart()
{
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
    $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
    $pid = @file_get_contents($pidfile);
    if ($GLOBALS["VERBOSE"]) {
        echo "{$pidtime}\n";
    }
    $unix = new unix();
    $squid = $unix->LOCATE_SQUID_BIN();
    if (!$GLOBALS["FORCE"]) {
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            if ($GLOBALS["VERBOSE"]) {
                echo "Already executed pid {$pid} since {$time}mn\n";
            }
            die;
        }
    }
    $mypid = getmypid();
    @file_put_contents($pidfile, $mypid);
    $timefile = $unix->file_time_min($pidtime);
    if ($GLOBALS["VERBOSE"]) {
        echo "Timelock:{$pidtime} {$timefile} Mn\n";
    }
    if (!$GLOBALS["FORCE"]) {
        if ($timefile < 5) {
            if ($GLOBALS["VERBOSE"]) {
                echo "{$timefile}mn require 5mn\n";
            }
            return;
        }
    }
    @unlink($pidtime);
    @file_put_contents($pidtime, time());
    if (!is_file("/home/ufdb/smtp-events/ACCESS_LOG")) {
        if ($GLOBALS["VERBOSE"]) {
            echo "/home/ufdb/smtp-events/ACCESS_LOG no such file\n";
        }
    }
    $array = explode("\n", @file_get_contents("/home/ufdb/smtp-events/ACCESS_LOG"));
    @unlink("/home/ufdb/smtp-events/ACCESS_LOG");
    $body = array();
    $mmstp = new ufdb_msmtp();
    $Subject = count($array) . " Web filtering blocked event(s)";
    $body[] = "Return-Path: <{$mmstp->smtp_sender}>";
    $body[] = "Date: " . date("D, d M Y H:i:s") . " +0100 (CET)";
    $body[] = "From: {$mmstp->smtp_sender}";
    $body[] = "Subject: {$Subject}";
    $body[] = "To: {$mmstp->recipient}";
    $body[] = "";
    $body[] = "";
    $body[] = @implode("\r\n", $array);
    $body[] = "";
    $body[] = "";
    $finalbody = @implode("\r\n", $body);
    if (!$mmstp->Send($finalbody)) {
        squid_admin_mysql(0, "Unable to send notification {$Subject} to {$mmstp->recipient}", "{$Subject} to {$mmstp->recipient}\n------------------\n" . @implode("\n", $array) . "\n\t\tThe following error encountered\n" . $mmstp->logs . "\n", __FILE__, __LINE__);
    }
}
开发者ID:articatech,项目名称:artica,代码行数:60,代码来源:exec.ufdb.smtp.release.php

示例7: xstart

function xstart()
{
    $unix = new unix();
    $sock = new sockets();
    $GLOBALS["CLASS_SOCKETS"] = $sock;
    $FORCED_TEXT = null;
    $NOTIFY = false;
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pidTime = "/usr/share/artica-postfix/ressources/logs/ARTICA_DBS_STATUS_FULL.db";
    $pid = $unix->get_pid_from_file($pidfile);
    $GLOBALS["CLASS_UNIX"] = $unix;
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        echo "Already executed\n";
        return;
    }
    if (!$GLOBALS["FORCE"]) {
        if ($unix->file_time_min($pidTime) < 30) {
            return;
        }
    }
    $GLOBALS["MAIN_ARRAY"] = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/ARTICA_DBS_STATUS.db"));
    ArticaWebFilter();
    ArticaUfdb();
    @mkdir("/usr/share/artica-postfix/ressources/logs", 0755, true);
    @unlink($pidTime);
    @file_put_contents($pidTime, serialize($GLOBALS["MAIN_ARRAY"]));
    if ($GLOBALS["VERBOSE"]) {
        echo "Saving {$pidTime}\n";
    }
    @chmod($pidTime, 0755);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:32,代码来源:exec.ufdb.databases.php

示例8: 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

示例9: compile_destination

function compile_destination($cacheid)
{
    $unix = new unix();
    $sock = new sockets();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".compile_destination." . __FUNCTION__ . ".pid";
    $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]: Nginx Already Artica task running PID {$pid} since {$time}mn\n";
        }
        return;
    }
    @file_put_contents($pidfile, getmypid());
    if (!is_numeric($cacheid)) {
        build_progress("Error Destination ID is not set", 110);
        return;
    }
    if ($cacheid == 0) {
        build_progress("Error Destination ID is Zero", 110);
        return;
    }
    $q = new mysql_squid_builder();
    $sql = "SELECT servername FROM reverse_www WHERE cache_peer_id={$cacheid}";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        build_progress("Error MySQL error", 110);
        echo $q->mysql_error;
        return;
    }
    $count = mysql_num_rows($results);
    if ($count == 0) {
        echo "{$sql}\n";
        build_progress("Error no destination for ID {$cacheid}", 110);
        return;
    }
    build_progress("{$count} Destination(s)", 5);
    $c = 0;
    $php = $unix->LOCATE_PHP5_BIN();
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $c++;
        $prc = $c / $count;
        $prc = $prc * 100;
        if ($prc > 90) {
            $prc = 90;
        }
        $servername = $ligne["servername"];
        build_progress("{reconfigure} {$servername}", $prc);
        system("{$php} /usr/share/artica-postfix/exec.nginx.single.php {$servername} --no-reload --output --no-buildmain");
    }
    build_progress("{cleaning_old_configs}...", 91);
    system("{$php} /usr/share/artica-postfix/exec.nginx.wizard.php --check-http");
    build_progress("{building_main_settings}", 95);
    system("{$php} /usr/share/artica-postfix/exec.nginx.php --main");
    build_progress("{$ligne["servername"]}: {reloading_reverse_proxy} ", 96);
    system("/etc/init.d/nginx reload --force");
    build_progress("{$ligne["servername"]}: {reloading_reverse_proxy}  {done}", 100);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:58,代码来源:exec.nginx.destinations.php

示例10: install_key

function install_key($keyfile)
{
    $path = "/usr/share/artica-postfix/ressources/conf/upload/{$keyfile}";
    $license_bin = "/opt/kaspersky/kav4proxy/bin/kav4proxy-licensemanager";
    $time = time();
    $unix = new unix();
    $pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = $unix->get_pid_from_file($pidFile);
    if ($unix->process_exists($pid)) {
        if ($unix->PROCCESS_TIME_MIN($pid, 10) < 2) {
            progress("{failed} Already running", 110);
            echo "Already runinng PID {$pid}\n";
            return;
        }
    }
    echo "License....: {$path}\n";
    echo "Binary File: {$license_bin}\n";
    if (!is_file($path)) {
        echo "{$path} No such file..\n";
        progress("{failed} {$keyfile} No such file", 110);
        die;
    }
    if (!is_file($license_bin)) {
        echo "{$path} No such file..\n";
        progress("{failed} " . basename($license_bin) . " No such binary", 110);
        @unlink($path);
        die;
    }
    $sock = new sockets();
    $nohup = $unix->find_program("nohup");
    $sock->SET_INFO("kavicapserverEnabled", 1);
    @unlink("/etc/artica-postfix/kav4proxy-licensemanager");
    @unlink("/etc/artica-postfix/kav4proxy-licensemanager-i");
    progress("{removing_old_licenses}", 20);
    system("/opt/kaspersky/kav4proxy/bin/kav4proxy-licensemanager -d a");
    progress("{installing} {$keyfile}", 30);
    $cmd = "/opt/kaspersky/kav4proxy/bin/kav4proxy-licensemanager -c /etc/opt/kaspersky/kav4proxy.conf -a {$path}";
    system($cmd);
    @unlink($path);
    progress("{analyze_license} {$keyfile}", 50);
    shell_exec("/opt/kaspersky/kav4proxy/bin/kav4proxy-licensemanager -i >/etc/artica-postfix/kav4proxy-licensemanager-i 2>&1");
    progress("{stopping_service}", 60);
    echo "/etc/init.d/kav4proxy stop\n";
    system("/etc/init.d/kav4proxy stop");
    progress("{starting_service}", 60);
    echo "/etc/init.d/kav4proxy start\n";
    system("{$nohup} /etc/init.d/kav4proxy start >/dev/null 2>&1 &");
    system("{$nohup} /etc/init.d/artica-status restart --force >/dev/null 2>&1 &");
    progress("{launch_updates}", 70);
    $nohup = $unix->find_program("nohup");
    $php = $unix - LOCATE_PHP5_BIN();
    sleep(2);
    progress("{launch_updates}", 80);
    shell_exec("{$nohup} /usr/share/artica-postfix/exec.keepup2date.php --update --force >/dev/null 2>&1 &");
    sleep(3);
    progress("{success}", 100);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:57,代码来源:exec.kav4proxy.license-manager.php

示例11: 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

示例12: ParseMainDir

function ParseMainDir()
{
    $unix = new unix();
    $mypid = getmypid();
    $kill = $unix->find_program("kill");
    $nohup = $unix->find_program("nohup");
    $php5 = $unix->LOCATE_PHP5_BIN();
    @mkdir("/etc/artica-postfix/pids", 0755, true);
    $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
    $pidtime_hour = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".hours.time";
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
    $pid = @file_get_contents($pidfile);
    if ($pid < 100) {
        $pid = null;
    }
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        if ($time > 60) {
            unix_system_kill_force($pid);
        } else {
            events("Already executed pid {$pid} since {$time}mn-> DIE");
            if ($GLOBALS["VERBOSE"]) {
                echo "Already executed pid {$pid} since {$time}mn\n";
            }
            die;
        }
    }
    $timeP = $unix->file_time_min($pidtime);
    if ($timeP < 3) {
        events("Main::Line: " . __LINE__ . " 3Mn minimal current: {$timeP}mn-> DIE");
        die;
    }
    @unlink($pidtime);
    @file_put_contents($pidtime, time());
    @file_put_contents($pidfile, $mypid);
    $dirs = $unix->dirdir("/var/log/artica-postfix/squid/queues");
    while (list($directory, $array) = each($dirs)) {
        $dirs2 = $unix->dirdir($directory);
        if (count($dirs2) == 0) {
            events("{$dirs2} 0 elements, remove...", __LINE__);
            @rmdir($directory);
            continue;
        }
        if (is_dir("{$directory}/SearchWords")) {
            events("Scanning {$directory}/SearchWords", __LINE__);
            ParseSubDir("{$directory}/SearchWords");
        }
    }
    $timeP = $unix->file_time_min($pidtime_hour);
    if ($timeP > 30) {
        @unlink($pidtime_hour);
        @file_put_contents($pidtime_hour, time());
        shell_exec("{$nohup} {$php5} /usr/share/artica-postfix/exec.squid-searchwords.php --hour >/dev/null 2>&1");
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:55,代码来源:exec.squid.words.parsers.php

示例13: start

function start($database, $table)
{
    $unix = new unix();
    if ($database == null) {
        WriteIsamLogs("Requested myismamchk database:{$database}, table: {$table} -> database is null");
        return;
    }
    if ($table == null) {
        WriteIsamLogs("Requested myismamchk database:{$database}, table: {$table} -> table is null");
        return;
    }
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . md5("{$database}{$table}") . ".pid";
    $pid = @file_get_contents("{$database}{$table}");
    if ($unix->process_exists($pid)) {
        $timepid = $unix->PROCCESS_TIME_MIN($pid);
        WriteIsamLogs("Already PID {$pid} running since {$timepid}mn, aborting");
        return;
    }
    @file_put_contents($pidfile, getmypid());
    WriteIsamLogs("Requested myismamchk database:{$database}, table: {$table}");
    $pgrep = $unix->find_program("pgrep");
    $myisamchk = $unix->find_program("myisamchk");
    $touch = $unix->find_program("touch");
    $myisamchk = $unix->find_program("myisamchk");
    $pgrep = $unix->find_program("pgrep");
    exec("{$pgrep} -l -f \"{$myisamchk}.*?{$table}\"", $results);
    while (list($index, $line) = each($results)) {
        if (preg_match("#pgrep#", $line)) {
            continue;
        }
        if (preg_match("#^[0-9]+\\s+#", $line)) {
            writelogs("{$line} already executed", @implode("\r\n", $results), __FUNCTION__, __FILE__, __LINE__);
            return;
        }
    }
    $MYSQL_DATADIR = $unix->MYSQL_DATADIR();
    if (!is_file("{$MYSQL_DATADIR}/{$database}/{$table}.MYD")) {
        WriteIsamLogs("unable to stat {$MYSQL_DATADIR}/{$database}/{$table}.MYD");
        return;
    }
    if (!is_file("{$MYSQL_DATADIR}/{$database}/{$table}.MYI")) {
        WriteIsamLogs("{$MYSQL_DATADIR}/{$database}/{$table}.MYI no such file");
        return;
    }
    $results = array();
    WriteIsamLogs("{$myisamchk} --safe-recover --backup {$MYSQL_DATADIR}/{$database}/{$table}.MYI");
    exec("{$myisamchk} --safe-recover --backup {$MYSQL_DATADIR}/{$database}/{$table}.MYI 2>&1", $results);
    while (list($index, $line) = each($results)) {
        WriteIsamLogs("{$line}");
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:51,代码来源:exec.myisamchk.php

示例14: Get_owncloud

function Get_owncloud()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
    $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
    $pid = @file_get_contents($pidfile);
    $unix = new unix();
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $time = $unix->PROCCESS_TIME_MIN($pid);
        if ($GLOBALS["VERBOSE"]) {
            echo "Already executed pid {$pid} since {$time}mn\n";
        }
        die;
    }
    $uri = download();
    if ($uri == null) {
        return;
    }
    $curl = new ccurl($uri);
    $curl->NoHTTP_POST = true;
    $cp = $unix->find_program("cp");
    $rm = $unix->find_program("rm");
    progress("Downloading Owncloud package...", 25);
    if (!$curl->GetFile("/root/owncloud.tar.gz")) {
        progress("Failed download owncloud package", 110);
        return;
    }
    if (is_dir("/usr/share/owncloud")) {
        shell_exec("{$rm} -rf /usr/share/owncloud");
    }
    @mkdir("/usr/share/owncloud", 0755, true);
    if (!is_dir("/usr/share/owncloud")) {
        progress("/usr/share/owncloud permission denied", 110);
        @unlink("/root/owncloud.tar.gz");
        return;
    }
    $tar = $unix->find_program("tar");
    progress("Extracting package...", 35);
    shell_exec("{$tar} xf /root/owncloud.tar.gz -C /usr/share/owncloud/");
    @unlink("/root/owncloud.tar.gz");
    if (is_dir("/usr/share/owncloud/owncloud")) {
        shell_exec("{$cp} -rf /usr/share/owncloud/owncloud/* /usr/share/owncloud/");
        shell_exec("{$rm} -rf /usr/share/owncloud/owncloud");
    }
    if (is_file("/usr/share/owncloud/settings/settings.php")) {
        progress("Success...", 100);
        $unix->Process1(true);
        return;
    }
    progress("Failed...", 110);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:51,代码来源:compile-owncloud.php

示例15: parse

function parse()
{
    $TimeFile = "/etc/artica-postfix/pids/exec.squid.stats.quota-week.parser.php.time";
    $pidfile = "/etc/artica-postfix/pids/exec.squid.stats.quota-week.parser.php.pid";
    $unix = new unix();
    $pid = $unix->get_pid_from_file($pidfile);
    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 < 14) {
            return;
        }
        $kill = $unix->find_program("kill");
        unix_system_kill_force($pid);
    }
    @file_put_contents($pidfile, getmypid());
    $sock = new sockets();
    $SquidPerformance = intval($sock->GET_INFO("SquidPerformance"));
    $time = $unix->file_time_min($TimeFile);
    if (!$GLOBALS["FORCE"]) {
        if ($time < 1440) {
            return;
        }
    }
    @unlink($TimeFile);
    @file_put_contents($TimeFile, time());
    $f = $unix->DirFiles("/var/log/squid", "[0-9]+_QUOTASIZE\\.db");
    $export_path = "/home/artica/squid/dbExport";
    @mkdir($export_path, 0755, true);
    while (list($filename, $none) = each($f)) {
        preg_match("#([0-9]+)_#", $filename, $re);
        $xdate = $re[1];
        echo "{$filename} ( {$xdate} )\n";
        if ($SquidPerformance > 1) {
            if (!@copy("/var/log/squid/{$filename}", "{$export_path}/{$filename}")) {
                continue;
            }
            @unlink("/var/log/squid/{$filename}");
            continue;
        }
        if (!parse_file("/var/log/squid/{$filename}", $xdate)) {
            continue;
        }
        if (!@copy("/var/log/squid/{$filename}", "{$export_path}/{$filename}")) {
            continue;
        }
        @unlink("/var/log/squid/{$filename}");
    }
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:51,代码来源:exec.squid.stats.quota-week.parser.php


注:本文中的unix::PROCCESS_TIME_MIN方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。