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


PHP unix::find_program方法代码示例

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


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

示例1: startx

function startx()
{
    build_progress("{rebuild_ssl_cache}: Removing SSL cache", 10);
    $unix = new unix();
    $rm = $unix->find_program("rm");
    $chown = $unix->find_program("chown");
    if ($GLOBALS["RESTART"]) {
        build_progress("{rebuild_ssl_cache}: {stopping_proxy_service}", 30);
        system("/etc/init.d/squid stop --script=" . basename(__FILE__));
    }
    echo "Remove /var/lib/squid/session/ssl/ssl_db\n";
    shell_exec("{$rm} -rf /var/lib/squid/session/ssl/ssl_db");
    build_progress("{rebuild_ssl_cache}: Reconstruct SSL cache", 50);
    $sslcrtd_program = $unix->squid_locate_generic_bin("ssl_crtd");
    system("{$sslcrtd_program} -c -s /var/lib/squid/session/ssl/ssl_db");
    system("{$chown} -R squid:squid /var/lib/squid/session");
    build_progress("{rebuild_ssl_cache}: Reload Proxy service", 60);
    system("/etc/init.d/cache-tail restart --force");
    if ($GLOBALS["RESTART"]) {
        build_progress("{rebuild_ssl_cache}: {starting_proxy_service}", 30);
        system("/etc/init.d/squid start --script=" . basename(__FILE__));
        build_progress("{rebuild_ssl_cache}: {done}", 100);
        return;
    }
    build_progress("{rebuild_ssl_cache}: Reload Proxy service", 70);
    system("/etc/init.d/squid reload --force --script=" . basename(__FILE__));
    build_progress("{rebuild_ssl_cache}: {done}", 100);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:28,代码来源:exec.sslcrtd.flush.php

示例2: disks_scan

function disks_scan()
{
    $unix = new unix();
    $btrfs = $unix->find_program("btrfs");
    $blkid = $unix->find_program("blkid");
    $cmd = "{$btrfs} filesystem show 2>&1";
    writelogs_framework("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
    exec($cmd, $results);
    while (list($num, $ligne) = each($results)) {
        if (preg_match("#Label:\\s+'(.*?)'\\s+uuid:\\s+(.+)#i", $ligne, $re)) {
            $UUID = $re[2];
            $array[$UUID]["LABEL"] = $re[1];
            $array[$UUID]["DEV"] = exec("{$blkid} -U {$UUID}");
            $array[$UUID]["MOUNTED"] = $unix->MOUNTED_PATH($array[$UUID]["DEV"]);
            $array[$UUID]["DF"] = $unix->BLKID_INFOS($array[$UUID]["DEV"]);
            continue;
        }
        if (preg_match("#Total devices.+?FS bytes used (.+)#", $ligne, $re)) {
            $array[$UUID]["USED"] = $re[1];
            continue;
        }
        if (preg_match("#devid\\s+([0-9]+)\\s+size\\s+(.+?)\\s+used\\s+(.+?)\\s+path\\s+(.+)#", $ligne, $re)) {
            writelogs_framework("{$UUID}: {$ligne}", __FUNCTION__, __FILE__, __LINE__);
            writelogs_framework("{$UUID}: {$re[4]}: SIZE: {$re[2]}", __FUNCTION__, __FILE__, __LINE__);
            $array[$UUID]["DEVICES"][$re[1]]["SIZE"] = $re[2];
            $array[$UUID]["DEVICES"][$re[1]]["USED"] = $re[3];
            $array[$UUID]["DEVICES"][$re[1]]["DEV"] = $re[4];
        }
    }
    echo "<articadatascgi>" . base64_encode(serialize($array)) . "</articadatascgi>";
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:btrfs.php

示例3: ReloadMacHelpers

function ReloadMacHelpers($output = false)
{
    @mkdir("/var/log/squid/reload", 0755, true);
    $unix = new unix();
    $pgrep = $unix->find_program("pgrep");
    $rm = $unix->find_program("rm");
    shell_exec("{$rm} /var/log/squid/reload/*.ufdbgclient.php");
    if (is_file("/var/log/squid/UfdbguardCache.db")) {
        @unlink("/var/log/squid/UfdbguardCache.db");
    }
    exec("{$pgrep} -l -f \"ufdbgclient.php\" 2>&1", $results);
    while (list($index, $ligne) = each($results)) {
        if (preg_match("#pgrep#", $ligne)) {
            continue;
        }
        if (!preg_match("#^([0-9]+)\\s+#", $ligne, $re)) {
            continue;
        }
        $PIDS[] = $re[1];
        echo "Starting......: " . date("H:i:s") . " [INIT]: Webfilter client reloading PID {$re[1]}\n";
        @touch("/var/log/squid/reload/{$re[1]}.ufdbgclient.php");
        @chown("/var/log/squid/reload/{$re[1]}.ufdbgclient.php", "squid");
        @chgrp("/var/log/squid/reload/{$re[1]}.ufdbgclient.php", "squid");
    }
    squid_admin_mysql(2, count($PIDS) . " Artica helper(s) was reloaded", null, __FILE__, __LINE__);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:26,代码来源:exec.ufdbclient.reload.php

示例4: DropBoxUri

function DropBoxUri()
{
    $sock = new sockets();
    $DropBoxUri = $sock->GET_INFO("DropBoxUri");
    if (strlen($DropBoxUri) > 10) {
        echo $DropBoxUri . "\n";
        return;
    }
    $unix = new unix();
    $grep = $unix->find_program("grep");
    $tail = $unix->find_program("tail");
    exec("{$grep} \"Please visit\" /var/log/dropbox.log|{$tail} -n 2000 2>&1", $results);
    while (list($dir, $line) = each($results)) {
        if (preg_match("#Please visit\\s+(.+?)\\s+to link#", $line, $re)) {
            $uri = trim($re[1]);
            break;
        }
    }
    if ($uri != null) {
        $sock = new sockets();
        $sock->SET_INFO("DropBoxUri", $uri);
        echo $uri . "\n";
        return;
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:25,代码来源:exec.dropbox.php

示例5: getlongkey

function getlongkey()
{
    $sock = new sockets();
    $RacconKey = $sock->GET_INFO("RacconKey");
    if ($sock->GET_INFO("RacconKey") != null) {
        return $RacconKey;
    }
    $unix = new unix();
    $xxd_bin = $unix->find_program("xxd");
    $dd_bin = $unix->find_program("dd");
    $cmd = "{$dd_bin} if=/dev/random count=24 bs=1|{$xxd_bin} -ps 2>&1";
    if ($GLOBALS["VERBOSE"]) {
        echo "{$cmd}\n";
    }
    exec($cmd, $results);
    while (list($num, $ligne) = each($results)) {
        if (preg_match("#\\s+[a-z]+#", trim($ligne))) {
            if ($GLOBALS["VERBOSE"]) {
                echo "skipped \"{$ligne}\" -> \\s+[a-z]+\n";
            }
            continue;
        }
        if (strlen(trim($ligne)) < 48) {
            if ($GLOBALS["VERBOSE"]) {
                echo "skipped \"" . strlen(trim($ligne)) . "\" length+\n";
            }
            continue;
        }
        $key = trim($ligne);
    }
    $sock->SET_INFO("RacconKey", $key);
    return $key;
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:33,代码来源:exec.raccon.php

示例6: startx

function startx()
{
    $unix = new unix();
    build_progress(50, "{refresh} CPUS");
    @unlink("/etc/artica-postfix/CPU_NUMBER");
    build_progress(55, "{refresh} CPUS");
    @unlink("/usr/share/artica-postfix/ressources/interface-cache/CPU_NUMBER");
    build_progress(60, "{rescan-disk-system}");
    $dirs = $unix->dirdir("/sys/class/scsi_host");
    $echo = $unix->find_program("echo");
    $udevadm = $unix->find_program("udevadm");
    $php = $unix->LOCATE_PHP5_BIN();
    while (list($dirpath, $line) = each($dirs)) {
        $basename = basename($dirpath);
        if (!preg_match("#host[0-9]+#", $basename)) {
            continue;
        }
        $cmd = "{$echo} \"- - -\" >{$dirpath}/scan";
        build_progress(65, "{rescan-disk-system}" . dirname($dirpath));
        shell_exec($cmd);
    }
    build_progress(70, "{rescan-disk-system}");
    $cmdline = "{$php} /usr/share/artica-postfix/exec.usb.scan.write.php --verbose";
    system($cmd);
    build_progress(80, "{rescan-network-system}");
    system("{$udevadm} control --reload-rules");
    system("{$udevadm} trigger --attr-match=subsystem=net");
    sleep(3);
    system("/usr/share/artica-postfix/bin/process1 --force --verbose --" . time());
    build_progress(100, "{refresh} {done}");
}
开发者ID:articatech,项目名称:artica,代码行数:31,代码来源:exec.system.refresh.php

示例7: ScanPurgeexc

function ScanPurgeexc()
{
    $unix = new unix();
    $purge = $unix->find_program("purge");
    $pidof = $unix->find_program("pidof");
    $kill = $unix->find_program("kill");
    exec("{$pidof} {$purge} 2>&1", $results);
    $pp = array();
    $pids = explode(" ", @implode("", $results));
    while (list($index, $pid) = each($pids)) {
        if (!is_numeric(trim($pid))) {
            continue;
        }
        $pp[] = $pid;
    }
    $count = count($pp);
    if ($count > 1) {
        unset($pp[0]);
        while (list($index, $pid) = each($pp)) {
            unix_system_kill_force($pid);
        }
    }
    $count = count($pp);
    return $count;
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:25,代码来源:exec.squid.purge.php

示例8: build

function build()
{
    $sock = new sockets();
    $unix = new unix();
    $sysctl = $unix->find_program("sysctl");
    $echo = $unix->find_program("echo");
    $HugePages = $sock->GET_INFO("HugePages");
    $KernelShmmax = $sock->GET_INFO("KernelShmmax");
    $meminfo = MemInfo();
    $HUGEPAGESIZE = intval($meminfo["HUGEPAGESIZE"]);
    $HUGEPAGESIZEBytes = $HUGEPAGESIZE;
    if (!is_numeric($HugePages)) {
        $HugePages = 0;
    }
    if (!is_numeric($KernelShmmax)) {
        $KernelShmmax = 0;
    }
    if ($HugePages > 0) {
        $HugePagesB = $HugePages * 1024;
        $HugePagesB = $HugePagesB * 1024;
        $HugePagesF = $HugePagesB / $HUGEPAGESIZEBytes;
        echo "HUGEPAGESIZE = {$HUGEPAGESIZE} ({$HUGEPAGESIZEBytes} bytes) " . FormatBytes($HUGEPAGESIZEBytes / 1024) . "\n";
        echo "HugePages = {$HugePages} Mb ({$HugePagesB} bytes)\n";
        echo "HugePages Final = {$HugePagesF} " . FormatBytes($HugePagesF / 1024) . " \n";
        $unix->sysctl("vm.nr_hugepages", $HugePagesF);
        shell_exec("{$sysctl} -w vm.nr_hugepages={$HugePagesF}");
        for ($i = 0; $i < 10; $i++) {
            shell_exec("{$echo} {$HugePagesF} > /proc/sys/vm/nr_hugepages");
            sleep(1);
        }
    }
    // sysctl
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:33,代码来源:exec.HugePages.php

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

示例10: restore

function restore($filename)
{
    $unix = new unix();
    $sock = new sockets();
    $TMP = $unix->FILE_TEMP();
    $filenameBase = basename($filename);
    if (!is_file($filename)) {
        echo "{$filename} no such file\n";
        build_progress("{failed}", 110);
    }
    $tmpf = $unix->FILE_TEMP();
    build_progress("{uncompress} {$filenameBase}", 10);
    if (!$unix->uncompress($filename, $tmpf)) {
        @unlink($filename);
        build_progress("{uncompress} {$filenameBase} {failed}", 110);
        return;
    }
    @unlink($filename);
    build_progress("{importing} {$tmpf}", 50);
    $q = new mysql_squid_builder();
    $nice = $unix->EXEC_NICE();
    $mysql = $unix->find_program("mysql");
    $gzip = $unix->find_program("gzip");
    $nohup = $unix->find_program("nohup");
    $echo = $unix->find_program("echo");
    $rm = $unix->find_program("rm");
    $php = $unix->LOCATE_PHP5_BIN();
    $sh[] = "#!/bin/sh";
    $sh[] = "{$echo} \"{$mysql} -> {$filenameBase}\"";
    $sh[] = "{$nice} {$mysql} {$q->MYSQL_CMDLINES} -f squidlogs < {$tmpf}";
    $sh[] = "{$rm} {$TMP}.sh";
    $sh[] = "\n";
    @file_put_contents("{$TMP}.sh", @implode("\n", $sh));
    @chmod("{$TMP}.sh", 0755);
    build_progress(10, "Starting restore {$filenameBase} - " . basename("{$TMP}.sh") . " ");
    system("{$nohup} {$TMP}.sh >{$TMP}.txt 2>&1 &");
    sleep(1);
    $PID = $unix->PIDOF_PATTERN("{$TMP}.sh");
    echo "Running PID {$PID}\n";
    while ($unix->process_exists($PID)) {
        build_progress(50, "Starting restoring {$filenameBase}");
        sleep(3);
        $PID = $unix->PIDOF_PATTERN("{$TMP}.sh");
        echo "Running PID {$PID}\n";
    }
    echo @file_get_contents("{$TMP}.txt") . "\n";
    @unlink("{$TMP}.sh");
    @unlink("{$TMP}.txt");
    build_progress(50, "{restore} {done} {$filenameBase}");
    build_progress(50, "{restore} Analyze Hourly tables");
    system("{$php} /usr/share/artica-postfix/exec.squid.stats.hours.php --force --verbose");
    build_progress(60, "{restore} Repair Hourly tables");
    system("{$php} /usr/share/artica-postfix/exec.squid.stats.hours.php --repair --force --verbose");
    build_progress(70, "{restore} Repair Table days");
    system("{$php} /usr/share/artica-postfix/exec.squid.stats.repair.php --tables-day --repair --force --verbose");
    build_progress(80, "{restore} Repair sums");
    system("{$php} /usr/share/artica-postfix/exec.squid.stats.totals.php --repair --force --verbose");
    build_progress(100, "{restore} Done");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:59,代码来源:exec.articadb.restore.php

示例11: start

function start()
{
    $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)) {
        return;
    }
    @file_put_contents($pidFile, getmypid());
    $time = $unix->file_time_min($pidtime);
    if ($time < 5) {
        return;
    }
    @file_put_contents($pidtime, time());
    $free = $unix->find_program("free");
    $echo = $unix->find_program("echo");
    $sync = $unix->find_program("sync");
    $swapoff = $unix->find_program("swapoff");
    $swapon = $unix->find_program("swapon");
    exec("{$free} 2>&1", $results);
    $used = 0;
    $total = 0;
    while (list($num, $ligne) = each($results)) {
        if (preg_match("#Swap:\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)#", $ligne, $re)) {
            $total = $re[1];
            $used = $re[2];
        }
    }
    if (!is_numeric($total)) {
        return;
    }
    if ($total == 0) {
        return;
    }
    if ($used == 0) {
        return;
    }
    if ($total == $used) {
        return;
    }
    $tot1 = $used / $total;
    $tot1 = $tot1 * 100;
    if ($GLOBALS["VERBOSE"]) {
        echo "Swap:{$used}/{$total} - {$tot1}\n";
    }
    $perc = round($tot1);
    if ($GLOBALS["VERBOSE"]) {
        echo "Swap:{$used}/{$total} {$perc}%\n";
    }
    $t = time();
    $GLOBALS["ALL_SCORES"]++;
    shell_exec("{$swapoff} -a && {$swapon} -a");
    $usedTXT = FormatBytes($used);
    $report = $unix->ps_mem_report();
    $distance = $unix->distanceOfTimeInWords($t, time(), true);
    squid_admin_mysql(0, "System swap exceed rule: {$perc}%", "Used {$usedTXT}\nSystem cache was flushed took {$distance}\nThis means you did have enough memory for this computer.\n{$report}", __FILE__, __LINE__);
}
开发者ID:articatech,项目名称:artica,代码行数:58,代码来源:exec.squid.swapoff.php

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

示例13: install

function install($filename)
{
    $GLOBALS["PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/squid.install.progress";
    $GLOBALS["LOG_FILE"] = "/usr/share/artica-postfix/ressources/logs/web/squid.install.progress.txt";
    $unix = new unix();
    $LINUX_CODE_NAME = $unix->LINUX_CODE_NAME();
    $LINUX_DISTRIBUTION = $unix->LINUX_DISTRIBUTION();
    $LINUX_VERS = $unix->LINUX_VERS();
    $LINUX_ARCHITECTURE = $unix->LINUX_ARCHITECTURE();
    $APACHEUSER = $unix->APACHE_SRC_ACCOUNT();
    $DebianVer = "debian{$LINUX_VERS[0]}";
    $TMP_DIR = $unix->TEMP_DIR();
    $ORGV = @file_get_contents("/usr/share/artica-postfix/VERSION");
    $PATCH_VER = null;
    $tarballs_file = "/usr/share/artica-postfix/ressources/conf/upload/{$filename}";
    echo "Package {$tarballs_file}\n";
    $size = filesize($tarballs_file);
    echo "Size....................: " . FormatBytes($size / 1024) . "\n";
    build_progress("Analyze...", 10);
    echo "Current system..........: {$LINUX_CODE_NAME} {$LINUX_DISTRIBUTION} {$LINUX_VERS[0]}/{$LINUX_VERS[1]} {$LINUX_ARCHITECTURE}\n";
    echo "Package.................: {$filename}\n";
    echo "Temp dir................: {$TMP_DIR}\n";
    if (!is_file($tarballs_file)) {
        echo "{$tarballs_file} no such file...\n";
        build_progress("No such file...", 110);
        return;
    }
    echo "Uncompressing {$tarballs_file}...\n";
    build_progress("{extracting} {$filename}...", 20);
    $chown = $unix->find_program("chown");
    $chmod = $unix->find_program("chmod");
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    $nohup = $unix->find_program("nohup");
    $php = $unix->LOCATE_PHP5_BIN();
    $squid = $unix->LOCATE_SQUID_BIN();
    build_progress("{extracting} {$filename}...", 50);
    system("{$tar} xf {$tarballs_file} -C /");
    echo "Removing {$tarballs_file}...\n";
    @unlink($tarballs_file);
    shell_exec("{$rm} -rf /usr/share/artica-postfix/ressources/conf/upload/*");
    @unlink(dirname(__FILE__) . "/ressources/logs/squid.compilation.params");
    build_progress("{restarting} Squid-cache...", 60);
    system("/etc/init.d/squid restart --force");
    build_progress("{reconfiguring} Squid-cache...", 65);
    system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
    build_progress("{reconfiguring} {APP_UFDBGUARD}...", 70);
    system("{$php} /usr/share/artica-postfix/exec.squidguard.php --build --force");
    build_progress("{restarting} {APP_C_ICAP}...", 80);
    system("/etc/init.d/c-icap restart");
    build_progress("Refresh local versions...", 90);
    system('/usr/share/artica-postfix/bin/process1 --force --verbose --' . time());
    $squid_version = x_squid_version();
    build_progress("{success} v.{$squid_version}...", 100);
    echo "Starting......: " . date("H:i:s") . " Done you can close the screen....\n";
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:56,代码来源:exec.squid.uncompress.php

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

示例15: install

function install()
{
    $unix = new unix();
    $DISTRICODE = $unix->LINUX_CODE_NAME();
    $arch = $unix->LINUX_ARCHITECTURE();
    $VERS = $unix->LINUX_VERS();
    $dpkg = $unix->find_program("dpkg");
    echo "DISTRICODE:{$DISTRICODE} \n";
    if (!python_verify_modules("MySQLdb")) {
        $unix->DEBIAN_INSTALL_PACKAGE("python-mysqldb");
    }
    if (!python_verify_modules("ldap")) {
        echo "Installing python-ldap\n";
        if ($DISTRICODE == "DEBIAN") {
            if ($arch == 64) {
                if ($VERS[0] == 6) {
                    if (is_file("/usr/share/artica-postfix/bin/install/postfix/python-6-ldap-amd64.deb")) {
                        shell_exec("{$dpkg} -i --force-all /usr/share/artica-postfix/bin/install/postfix/python-6-ldap-amd64.deb");
                    }
                }
                if ($VERS[0] == 7) {
                    if (is_file("/usr/share/artica-postfix/bin/install/postfix/python-7-ldap-amd64.deb")) {
                        shell_exec("{$dpkg} -i --force-all /usr/share/artica-postfix/bin/install/postfix/python-7-ldap-amd64.deb");
                    }
                }
            }
        }
    }
    if (!python_verify_modules("ldap")) {
        $unix->DEBIAN_INSTALL_PACKAGE("python-ldap");
    }
    if (!python_verify_modules("ldap")) {
        echo "Warning, ldap/python-ldap not installed...\n";
        return;
    }
    if (!python_verify_modules("MySQLdb")) {
        echo "Warning, MySQLdb/python-mysqldb not installed...\n";
        return;
    }
    echo "MySQLdb / python-mysqldb OK\n";
    echo "LDAP / python-ldap OK\n";
    $tmpdir = $unix->TEMP_DIR() . "/iredmail";
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    if (!is_file("/usr/share/artica-postfix/bin/install/postfix/iredapd.tar.gz")) {
        return;
    }
    @mkdir($tmpdir, 0755, true);
    shell_exec("{$tar} xf /usr/share/artica-postfix/bin/install/postfix/iredapd.tar.gz -C /");
    if (!is_file("/opt/iRedAPD/iredapd.py")) {
        return;
    }
    @chmod("/opt/iRedAPD/iredapd.py", 0755);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:54,代码来源:exec.iredmail.install.php


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