Exemplo n.º 1
0
function php_fpm($aspid = false)
{
    $unix = new unix();
    if (is_file("/etc/lsb-release")) {
        if ($GLOBALS["VERBOSE"]) {
            "CheckSourcesList: Ubuntu system, aborting\n";
        }
    }
    if (!is_file("/etc/debian_version")) {
        return;
    }
    $phpfpm = $unix->APACHE_LOCATE_PHP_FPM();
    if (is_file($phpfpm)) {
        nginx();
        return;
    }
    if ($aspid) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $pidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
        $kill = $unix->find_program("kill");
        $timexec = $unix->file_time_min($pidTime);
        if ($timexec < 240) {
            return;
        }
        @unlink($pidTime);
        @file_put_contents($pidTime, time());
        $pid = $unix->get_pid_from_file($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            if ($time < 30) {
                return;
            }
            unix_system_kill_force($pid);
        }
        @file_put_contents($pidfile, getmypid());
    }
    $ver = trim(@file_get_contents("/etc/debian_version"));
    preg_match("#^([0-9]+)\\.#", $ver, $re);
    if (preg_match("#squeeze\\/sid#", $ver)) {
        $Major = 6;
    }
    $Major = $re[1];
    if ($Major != 6) {
        echo "CheckSourcesList: Debian version <> {$Major} aborting...\n";
        return;
    }
    Check_dotdeb();
    $unix = new unix();
    $aptget = $unix->find_program("apt-get");
    echo "CheckSourcesList: Installing php5-fpm\n";
    $cmd = "DEBIAN_FRONTEND=noninteractive {$aptget} -o Dpkg::Options::=\"--force-confnew\" --force-yes -y install php5-fpm libapache2-mod-fastcgi 2>&1";
    echo "CheckSourcesList: {$cmd}\n";
    shell_exec($cmd);
    $phpfpm = $unix->APACHE_LOCATE_PHP_FPM();
    if (is_file($phpfpm)) {
        $php = $unix->LOCATE_PHP5_BIN();
        shell_exec("{$php} /usr/share/artica-postfix/exec.initslapd.php --phppfm");
        APTToSyslog("Restarting PHP-FPM");
        shell_exec("/etc/init.d/php5-fpm restart");
        shell_exec("/etc/init.d/artica-postfix restart apache");
        shell_exec("/etc/init.d/artica-status reload");
        shell_exec("/etc/init.d/artica-framework restart");
        shell_exec("/etc/init.d/monit restart");
        shell_exec("{$php} /usr/share/artica-postfix/exec.freeweb.php --build");
    }
}
Exemplo n.º 2
0
function CleanLOGSF()
{
    $unix = new unix();
    $Pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $PidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    // /etc/artica-postfix/pids/exec.clean.logs.php.squidClean.time
    if ($GLOBALS["VERBOSE"]) {
        echo "Pidfile: {$Pidfile}\n";
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "PidTime: {$PidTime}\n";
    }
    $pid = $unix->get_pid_from_file($Pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        if ($GLOBALS["VERBOSE"]) {
            echo "Aborting Task already running pid {$pid} " . __FUNCTION__ . "()\n";
        }
        return;
    }
    @file_put_contents($Pidfile, getmypid());
    if (!$GLOBALS["VERBOSE"]) {
        $time = $unix->file_time_min($PidTime);
        if ($time < 15) {
            echo "Only each 15mn\n";
            die;
        }
        @unlink($PidTime);
        @file_put_contents($PidTime, time());
    }
    Clean_tmp_path(true);
    varlog();
    $squidbin = $unix->LOCATE_SQUID_BIN();
    if (is_file($squidbin)) {
        squidClean();
    }
    CleanLogs(true);
    logrotatelogs(true);
    Clean_tmp_path(true);
    artica_logs();
    nginx();
    sessions_clean();
    die;
}
Exemplo n.º 3
0
         }
     }
     exit(W::response($xml, $data, 'news'));
     break;
 case 13:
     $res = freebuf();
     $data = array(array('title' => 'Freebuf', 'cover' => $web . '/img/freebuf.jpg'));
     for ($i = 0; $i < count($data); $i++) {
         if ($res[$i]) {
             array_push($data, array('title' => $res[$i]['title'], 'note' => $res[$i]['description'], 'link' => $res[$i]['link']));
         }
     }
     exit(W::response($xml, $data, 'news'));
     break;
 case 14:
     $res = nginx();
     $data = array(array('title' => '好的架构减少运维,好的运维反哺架构', 'cover' => $web . '/img/meizi/' . mt_rand(0, 9) . '.jpg'));
     for ($i = 0; $i < count($data); $i++) {
         if ($res[$i]) {
             array_push($data, array('title' => $res[$i]['title'], 'note' => $res[$i]['description'], 'link' => $res[$i]['link']));
         }
     }
     exit(W::response($xml, $data, 'news'));
     break;
 case 15:
     $res = shejidaren();
     $data = array(array('title' => '设计达人-爱设计,爱分享。', 'cover' => $web . '/img/meizi/' . mt_rand(0, 9) . '.jpg'));
     for ($i = 0; $i < count($data); $i++) {
         if ($res[$i]) {
             array_push($data, array('title' => $res[$i]['title'], 'cover' => $res[$i]['cover'], 'link' => $res[$i]['link']));
         }
Exemplo n.º 4
0
    die;
}
if ($argv[1] == '--squid') {
    squidClean();
    Clean_tmp_path(true);
    die;
}
if ($argv[1] == '--artica-logs') {
    artica_logs();
    die;
}
if ($argv[1] == '--squidLogs') {
    die;
}
if ($argv[1] == '--nginx') {
    nginx();
    die;
}
if ($argv[1] == '--attachs') {
    Clean_attachments();
    die;
}
if ($argv[1] == '--access-logs') {
    die;
}
echo "Could not understand your query ???\n";
if (systemMaxOverloaded()) {
    writelogs("This system is too many overloaded, die()", __FUNCTION__, __FILE__, __LINE__);
    die;
}
function CleanLOGSF()
Exemplo n.º 5
0
/**
 * 更新伪静态规则
 */
function m__update_url()
{
    htaccess();
    iis_httpd_ini();
    nginx();
    die('{"code":"0","msg":"更新伪静态规则成功"}');
}
Exemplo n.º 6
0
<?php

header('Content-type:text/html;charset=utf-8');
function nginx()
{
    $data = array();
    $url = 'http://www.nginx.cn/feed';
    $result = file_get_contents($url);
    $xml = simplexml_load_string($result, 'SimpleXMLElement', LIBXML_NOCDATA);
    for ($i = 0; $i < 6; $i++) {
        array_push($data, array('title' => $xml->channel->item[$i]->title, 'description' => $xml->channel->item[$i]->description, 'link' => $xml->channel->item[$i]->link));
    }
    return $data;
}
print_r(nginx());
Exemplo n.º 7
0
         $php = $unix->LOCATE_PHP5_BIN();
         $nohup = $unix->find_program("nohup");
         shell_exec2("{$nohup} {$php} /usr/share/artica-postfix/exec.squid.run.schedules.php >/dev/null 2>&1 &");
     }
 }
 $conf[] = squid_master_status(true);
 $conf[] = kav4Proxy_status();
 $conf[] = proxy_pac_status();
 $conf[] = squidguardweb();
 $conf[] = ufdbguardd();
 $conf[] = freshclam();
 $conf[] = articadb();
 $conf[] = winbindd();
 $conf[] = squid_db();
 $conf[] = haarp();
 $conf[] = nginx();
 $conf[] = ftp_proxy();
 $conf[] = c_icap_master_status();
 $conf[] = cntlm();
 $conf[] = cntlm_parent();
 $conf[] = rdpproxy_authhook();
 $conf[] = rdpproxy();
 $conf[] = clamd();
 $conf[] = dnsmasq();
 $conf[] = ufdbguardd_client();
 $conf[] = ucarp();
 $conf[] = hotspot_web();
 $conf[] = hotspot_fw();
 $conf[] = squid_nat();
 $conf[] = ziproxy();
 $conf[] = ufdbcat();