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

PHP unix类代码示例

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

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



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

示例1: cron

function cron()
{
    $unix = new unix();
    $files = $unix->DirFiles("/etc/cron.d");
    $sql = "SELECT CronSchedule,ID FROM imapsync";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        return null;
    }
    while (list($index, $line) = each($files)) {
        if ($index == null) {
            continue;
        }
        if (preg_match("#^imapsync-#", $index)) {
            @unlink("/etc/cron.d/{$index}");
        }
    }
    $sql = "SELECT CronSchedule,ID FROM imapsync";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if (trim($ligne["CronSchedule"] == null)) {
            continue;
        }
        $f[] = "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/usr/share/artica-postfix/bin";
        $f[] = "MAILTO=\"\"";
        $f[] = "{$ligne["CronSchedule"]}  root " . __FILE__ . " --sync {$ligne["ID"]}";
        $f[] = "";
        @file_put_contents("/etc/cron.d/imapsync-{$ligne["ID"]}", implode("\n", $f));
        @chmod("/etc/cron.d/imapsync-{$ligne["ID"]}", 600);
        unset($f);
    }
}
开发者ID:brucewu16899,项目名称:artica,代码行数:34,代码来源:exec.zarafa-migrate.php


示例2: startx

function startx()
{
    $unix = new unix();
    $php = $unix->LOCATE_PHP5_BIN();
    $tar = $unix->find_program("tar");
    build_progress("{backup_parameters}....", 5);
    chdir("/etc/squid3");
    system("cd /etc/squid3");
    system("{$tar} -czf /root/backup.squid.tar.gz *");
    build_progress("{reconfiguring}....", 10);
    system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
    build_progress("{stopping_service}....", 50);
    system("/etc/init.d/squid stop");
    build_progress("{starting_service}....", 80);
    system("/etc/init.d/squid start");
    $cachefile = "/usr/share/artica-postfix/ressources/logs/web/squid.start.progress";
    if (is_file($cachefile)) {
        $textAR = unserialize(@file_get_contents($cachefile));
        if ($textAR["POURC"] > 100) {
            build_progress("{restore_parameters}....", 90);
            shell_exec("{$tar} -xf /root/backup.squid.tar.gz -C /etc/squid3/");
            build_progress("{starting_service}....", 90);
            system("/etc/init.d/squid start");
        }
    }
    @unlink("/root/backup.squid.tar.gz");
    build_progress("{starting_service} {success}", 100);
    chdir("/root");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:29,代码来源:exec.squid.rebuild-restart.php


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


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


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


示例6: ScanQueue

function ScanQueue()
{
    $users = new usersMenus();
    $GLOBALS["SAMBA_INSTALLED"] = $users->SAMBA_INSTALLED;
    $unix = new unix();
    $path = "/var/log/artica-postfix/xapian";
    $SartOn = time();
    $files = $unix->DirFiles($path);
    if (count($files) == 0) {
        return;
    }
    cpulimitProcessName("omindex");
    while (list($num, $file) = each($files)) {
        $toScan = "{$path}/{$file}";
        if (ScanFile($toScan)) {
            @unlink($toScan);
        }
    }
    $SartOff = time();
    $time = distanceOfTimeInWords($SartOn, $SartOff);
    $countdir = count($GLOBALS["DIRS"]);
    cpulimitProcessNameKill("omindex");
    $echo = "InstantSearch {items}: {skipped}: {$GLOBALS["SKIPPED"]} {files}<br>{indexed}: {$GLOBALS["INDEXED"]} {files}<br>{duration}:{$time}";
    if ($GLOBALS["INDEXED"] > 0) {
        @file_put_contents("/usr/share/artica-postfix/ressources/logs/xapian.results", $echo);
        @chmod("/usr/share/artica-postfix/ressources/logs/xapian.results", 0777);
    }
    echo $echo . "\n";
}
开发者ID:brucewu16899,项目名称:artica,代码行数:29,代码来源:exec.xapian.index.php


示例7: build_rules

function build_rules()
{
    $q = new mysql_squid_builder();
    $unix = new unix();
    $SQUID_BIN = $unix->LOCATE_SQUID_BIN();
    build_progress("{IT_charter}", 25);
    $sql = "SELECT ID,title FROM itcharters WHERE enabled=1";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        build_progress("{IT_charter} {mysql_error}", 110);
        echo $q->mysql_error;
        return;
    }
    if (mysql_num_rows($results) == 0) {
        @unlink("/etc/squid3/itCharts.enabled.db");
        squid_admin_mysql(1, "Reloading Proxy service (itCharts)", null, __FILE__, __LINE__);
        build_progress("{IT_charter} {reload_proxy_service}", 90);
        system("{$SQUID_BIN} -f /etc/squid3/squid.conf -k reconfigure");
        build_progress("{IT_charter} {done} 0 {item}", 100);
        return;
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        build_progress("{$ligne["title"]}", 50);
        echo "{$ligne["ID"]}: {$ligne["title"]}\n";
        $MAIN[$ligne["ID"]] = $ligne["title"];
    }
    @file_put_contents("/etc/squid3/itCharts.enabled.db", serialize($MAIN));
    squid_admin_mysql(1, "Reloading Proxy service (itCharts)", null, __FILE__, __LINE__);
    build_progress("{IT_charter} {reload_proxy_service}", 90);
    system("{$SQUID_BIN} -f /etc/squid3/squid.conf -k reconfigure");
    build_progress("{IT_charter} {done} " . count($MAIN) . " {items}", 100);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:32,代码来源:exec.itchart.php


示例8: xstart

function xstart()
{
    $sock = new sockets();
    $unix = new unix();
    $php = $unix->LOCATE_PHP5_BIN();
    $SquidAllow80Port = intval($sock->GET_INFO("SquidAllow80Port"));
    build_progress("{starting} {allow_80443_port}", 15);
    if ($SquidAllow80Port == 1) {
        build_progress("{stopping} {web_service}", 20);
        system("/etc/init.d/apache2 stop");
        build_progress("{stopping} Reverse Proxy", 30);
        system("/etc/init.d/nginx stop");
    } else {
        build_progress("{remove} 80/443 ports", 20);
        $q = new mysql_squid_builder();
        $q->QUERY_SQL("DELETE FROM proxy_ports WHERE `port`='80'");
        build_progress("{remove} 80/443 ports", 25);
        $q->QUERY_SQL("DELETE FROM proxy_ports WHERE `port`='443'");
        build_progress("{reconfigure_proxy_service}", 30);
        $php = $unix->LOCATE_PHP5_BIN();
        shell_exec("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
    }
    build_progress("{restarting_artica_status}", 80);
    system("/etc/init.d/artica-status restart --force");
    build_progress("{done}", 100);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:26,代码来源:exec.squid80443.php


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


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


示例11: export_to_zarafa

function export_to_zarafa($uid)
{
    $f[] = "First Name,Middle Name,Last Name,Title,Suffix,Initials,Web Page,Gender,Birthday,Anniversary,Location,Language,Internet Free Busy,Notes,E-mail Address,E-mail 2 Address,E-mail 3 Address,Primary Phone,Home Phone,Home Phone 2,Mobile Phone,Pager,Home Fax,Home Address,Home Street,Home Street 2,Home Street 3,Home Address PO Box,Home City,Home State,Home Postal Code,Home Country,Spouse,Children,Manager's Name,Assistant's Name,Referred By,Company Main Phone,Business Phone,Business Phone 2,Business Fax,Assistant's Phone,Company,Job Title,Department,Office Location,Organizational ID Number,Profession,Account,Business Address,Business Street,Business Street 2,Business Street 3,Business Address PO Box,Business City,Business State,Business Postal Code,Business Country,Other Phone,Other Fax,Other Address,Other Street,Other Street 2,Other Street 3,Other Address PO Box,Other City,Other State,Other Postal Code,Other Country,Callback,Car Phone,ISDN,Radio Phone,TTY/TDD Phone,Telex,User 1,User 2,User 3,User 4,Keywords,Mileage,Hobby,Billing Information,Directory Server,Sensitivity,Priority,Private,Categories";
    $ldap = new clladp();
    $ct = new user($uid);
    $dn = "ou={$uid},ou=People,dc={$ct->ou},dc=NAB,{$ldap->suffix}";
    $filter = "(objectClass=inetOrgPerson)";
    $attrs = array();
    $hash = $ldap->Ldap_search($dn, $filter, array("employeeNumber"));
    if ($GLOBALS["VERBOSE"]) {
        echo "[{$uid}]: Exporting {$hash["count"]} user(s)\n";
    }
    for ($i = 0; $i < $hash["count"]; $i++) {
        $emp = new contacts(null, $hash[$i]["employeenumber"][0]);
        $f[] = @implode(",", $emp->ContactTocsvArray());
    }
    $tmpfile = "/tmp/{$uid}." . time() . ".csv";
    @file_put_contents("{$tmpfile}", @implode("\n", $f));
    $unix = new unix();
    $php = $unix->LOCATE_PHP5_BIN();
    $basename = basename($tmpfile);
    $cmd = $php . " " . dirname(__FILE__) . "/exec.zarafa.csv2contacts.php {$uid} \"{$ct->password}\" {$basename} 2>&1";
    if ($GLOBALS["VERBOSE"]) {
        echo "[{$uid}]: {$cmd}\n";
    }
    exec($cmd, $results);
    if ($GLOBALS["VERBOSE"]) {
        while (list($num, $line) = each($results)) {
            echo "[{$uid}]: {$line}\n";
        }
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:32,代码来源:exec.zarafa.contacts-zarafa.php


示例12: database_empty

function database_empty()
{
    $hostname = $_GET["hostname"];
    if ($hostname == null) {
        $hostname = "master";
    }
    if ($hostname == "master") {
        $d[] = "/var/milter-greylist/greylist.db";
        $d[] = "/usr/share/artica-postfix/ressources/logs/mgrelist-db.inc";
    }
    if ($hostname != "master") {
        $d[] = "/var/milter-greylist/{$hostname}/greylist.db";
        $d[] = "/usr/share/artica-postfix/ressources/logs/mgrelist-{$_GET["hostname"]}.inc";
    }
    $d[] = "/usr/share/artica-postfix/ressources/logs/greylist-count-{$hostname}.tot";
    $d[] = "/usr/share/artica-postfix/ressources/logs/mgrelist-{$hostname}.inc";
    while (list($num, $line) = each($d)) {
        if (is_file($line)) {
            @unlink($line);
        }
    }
    $unix = new unix();
    $nohup = $unix->find_program("nohup");
    shell_exec("{$nohup} /etc/init.d/milter-greylist restart >/dev/null 2>&1 &");
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:25,代码来源:milter-greylist.php


示例13: fstabmount

function fstabmount()
{
    $unix = new unix();
    $fstabmount = $_GET["fstabmount"];
    $dev = $unix->FSTAB_GETDEV($fstabmount);
    if ($dev != null) {
        $ext = $unix->DISK_GET_TYPE($dev);
    }
    if ($ext == null) {
        $ext = "auto";
    }
    if (!is_dir($fstabmount)) {
        @mkdir($fstabmount);
    }
    $tmp = $unix->FILE_TEMP();
    if ($ext == "ext4") {
        $kernel = $unix->KERNEL_VERSION_BIN();
        error_log("framework::" . __FUNCTION__ . " kernel: {$kernel}");
        if ($kernel < 20629) {
            $ext = "ext4dev";
        }
    }
    $cmd = "/bin/mount -t {$ext} {$dev} {$fstabmount} >{$tmp} 2>&1";
    error_log("framework::" . __FUNCTION__ . " {$cmd}");
    shell_exec("/bin/mount -t {$ext} {$dev} {$fstabmount} >{$tmp} 2>&1");
    $results = @file_get_contents($tmp);
    @unlink($tmp);
    error_log("framework::" . __FUNCTION__ . " mount point is \"{$dev}\" ({$ext})={$results} line " . __LINE__);
    if (strlen($results) > 0) {
        echo "<articadatascgi>{$results}</articadatascgi>";
    }
}
开发者ID:brucewu16899,项目名称:artica,代码行数:32,代码来源:fstab-cmd.php


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


示例15: xstart

function xstart()
{
    $unix = new unix();
    $php = $unix->LOCATE_PHP5_BIN();
    $tar = $unix->find_program("tar");
    build_progress("{downloading} roundcubeemail-1.1.2.tar.gz", 20);
    $tmpfile = $unix->FILE_TEMP();
    $curl = new ccurl("http://articatech.net/download/postfix-debian7/roundcubeemail-1.1.2.tar.gz");
    if (!$curl->GetFile($tmpfile)) {
        echo "Failed: " . $curl->error . "\n";
        @unlink($tmpfile);
        build_progress("{failed} roundcubeemail-1.1.2.tar.gz", 110);
        return;
    }
    build_progress("{uncompressing} roundcubeemail-1.1.2.tar.gz", 50);
    system("{$tar} xf {$tmpfile} -C /");
    @unlink($tmpfile);
    if (!is_file("/usr/share/roundcube/index.php")) {
        build_progress("{uncompressing} roundcubeemail-1.1.2.tar.gz {failed}", 110);
        return;
    }
    build_progress("{verify_database}", 60);
    system("{$php} /usr/share/artica-postfix/exec.roundcube.php --database");
    build_progress("{restarting_service}", 70);
    system("{$php} /usr/share/artica-postfix/exec.roundcube.php --restart");
    system("/etc/init.d/artica-status restart");
    build_progress("{installing} roundcubeemail-1.1.2.tar.gz {success}", 100);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:28,代码来源:exec.roundcube.install.php


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


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


示例18: schedules

function schedules()
{
    $unix = new unix();
    $files = $unix->DirFiles("/etc/cron.d");
    $cron = new cron_macros();
    $php5 = $unix->LOCATE_PHP5_BIN();
    while (list($index, $line) = each($files)) {
        if ($index == null) {
            continue;
        }
        if (preg_match("#^LdapImport-#", $index)) {
            @unlink("/etc/cron.d/{$index}");
        }
    }
    $sql = "SELECT * FROM ldap_ou_import WHERE enabled=1";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if (trim($ligne["ScheduleMin"] == null)) {
            continue;
        }
        $schedule = $cron->cron_defined_macros[$ligne["ScheduleMin"]];
        $f[] = "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/usr/share/artica-postfix/bin";
        $f[] = "MAILTO=\"\"";
        $f[] = "{$schedule}  root {$php5} " . __FILE__ . " --import {$ligne["ID"]} >/dev/null 2>&1";
        $f[] = "";
        @file_put_contents("/etc/cron.d/LdapImport-{$ligne["ID"]}", implode("\n", $f));
        @chmod("/etc/cron.d/LdapImport-{$ligne["ID"]}", 600);
        unset($f);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:exec.domains.ldap.import.php


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


示例20: reset2

function reset2()
{
    system("clear");
    echo "Remove databases\n";
    $q = new mysql();
    echo "Remove database settings\n";
    $q->DELETE_DATABASE("artica_backup");
    echo "Remove database events\n";
    $q->DELETE_DATABASE("artica_events");
    echo "Remove database Proxy\n";
    $q = new mysql_squid_builder();
    $q->QUERY_SQL("DROP DATABASE `squidlogs`");
    echo "Remove Artica settings Proxy\n";
    $unix = new unix();
    $files = $unix->DirFiles("/etc/artica-postfix/settings/Daemons");
    while (list($filename, $value) = each($files)) {
        $fulename = "/etc/artica-postfix/settings/Daemons/{$filename}";
        echo "Removing {$filename}\n";
        @unlink($fulename);
    }
    @file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/ProxyUseArticaDB", 1);
    @file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/StatsPerfsSquidAnswered", 1);
    @file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/CacheManagement2", 1);
    @file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/EnablePHPFPM", 0);
    @file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/EnableArticaFrontEndToNGninx", 0);
    @file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/EnableArticaFrontEndToApache", 1);
    @file_put_contents("/root/build/etc/artica-postfix/settings/Daemons/EnableNginx", 0);
    echo "Restarting Web Console...\n";
    system('/etc/init.d/artica-webconsole restart');
    system("clear");
    echo "All data has been erased..\n";
    echo "Type Enter key to exit\n";
    $answer = trim(strtolower(fgets(STDIN)));
    die;
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:35,代码来源:exec.users.reset.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP unknown类代码示例发布时间:2022-05-23
下一篇:
PHP umiObjectsCollection类代码示例发布时间: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