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


PHP sockets::dnsmasq_enabled方法代码示例

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


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

示例1: build


//.........这里部分代码省略.........
                echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Artica Status...\n";
            }
            @file_put_contents("/etc/monit/conf.d/APP_POSTGRES.monitrc", @implode("\n", $f));
            //********************************************************************************************************************
        }
    }
    $f = array();
    @unlink("/etc/monit/conf.d/squid.monitrc");
    @unlink("/etc/monit/conf.d/APP_SQUIDMAIN.monitrc");
    // ********************************************************************************************************************
    $f = array();
    @unlink("/etc/monit/conf.d/APP_SQUIDDB.monitrc");
    build_progress_restart("{reconfiguring} Proxy service", 30);
    if (is_dir("/opt/squidsql/data")) {
        if ($SQUIDEnable == 1) {
            $f = array();
            $f[] = "check process APP_SQUID_DB with pidfile /var/run/squid-db.pid";
            $f[] = "\tstart program = \"/etc/init.d/squid-db start --monit\"";
            $f[] = "\tstop program = \"/etc/init.d/squid-db stop --monit\"";
            $f[] = "\tif failed unixsocket /var/run/mysqld/squid-db.sock then restart";
            $f[] = "\tif 5 restarts within 5 cycles then timeout";
            $f[] = "";
            if ($GLOBALS["OUTPUT"]) {
                echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Squid MySQL DB...\n";
            }
            @file_put_contents("/etc/monit/conf.d/APP_SQUIDDB.monitrc", @implode("\n", $f));
        }
    }
    // ********************************************************************************************************************
    $f = array();
    build_progress_restart("{reconfiguring} Dnsmasq", 31);
    @unlink("/etc/monit/conf.d/APP_DNSMASQ.monitrc");
    if ($users->dnsmasq_installed) {
        $enabled = $sock->dnsmasq_enabled();
        if ($enabled == 1) {
            $f[] = "check process APP_DNSMASQ with pidfile /var/run/dnsmasq.pid";
            $f[] = "\tstart program = \"/etc/init.d/dnsmasq start --monit\"";
            $f[] = "\tstop program = \"/etc/init.d/dnsmasq stop --monit\"";
            $f[] = "\tif 5 restarts within 5 cycles then timeout";
            $f[] = "";
            if ($GLOBALS["OUTPUT"]) {
                echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DnsMASQ...\n";
            }
            @file_put_contents("/etc/monit/conf.d/APP_DNSMASQ.monitrc", @implode("\n", $f));
        }
    }
    // ********************************************************************************************************************
    $f = array();
    build_progress_restart("{reconfiguring} Proftpd", 31);
    @unlink("/etc/monit/conf.d/APP_PROFTPD.monitrc");
    $proftpd = $unix->find_program("proftpd");
    if (is_file($proftpd)) {
        $enabled = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableProFTPD"));
        if ($enabled == 1) {
            $f[] = "check process APP_PROFTPD with pidfile /var/run/proftpd.pid";
            $f[] = "\tstart program = \"/etc/init.d/proftpd start --monit\"";
            $f[] = "\tstop program = \"/etc/init.d/proftpd stop --monit\"";
            $f[] = "\tif 5 restarts within 5 cycles then timeout";
            $f[] = "";
            if ($GLOBALS["OUTPUT"]) {
                echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DnsMASQ...\n";
            }
            @file_put_contents("/etc/monit/conf.d/APP_PROFTPD.monitrc", @implode("\n", $f));
        }
    }
    // ********************************************************************************************************************
开发者ID:articatech,项目名称:artica,代码行数:67,代码来源:exec.monit.php

示例2: build


//.........这里部分代码省略.........
    $f[] = "\treset_timedout_connection on;";
    $f[] = "\ttypes_hash_max_size 8192;";
    $f[] = "\tserver_names_hash_bucket_size 128;";
    $f[] = "\tserver_names_hash_max_size 512;";
    $f[] = "\tvariables_hash_max_size 512;";
    $f[] = "\tvariables_hash_bucket_size 128;";
    $f[] = "\tfastcgi_buffers 8 16k;";
    $f[] = "\tfastcgi_buffer_size 32k;";
    $f[] = "\tfastcgi_connect_timeout 300;";
    $f[] = "\tfastcgi_send_timeout 300;";
    $f[] = "\tfastcgi_read_timeout 300;";
    $f[] = "map \$scheme \$server_https {";
    $f[] = "default off;";
    $f[] = "https on;";
    $f[] = "}\t";
    $f[] = "\tgzip on;";
    $f[] = "\tgzip_disable msie6;";
    $f[] = "\tgzip_static on;";
    $f[] = "\tgzip_min_length 1100;";
    $f[] = "\tgzip_buffers 16 8k;";
    $f[] = "\tgzip_comp_level 9;";
    $f[] = "\tgzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;";
    $f[] = "\tgzip_vary on;";
    $f[] = "\tgzip_proxied any;";
    $f[] = "\toutput_buffers 1000 128k;";
    $f[] = "\tpostpone_output 1460;";
    $f[] = "\tsendfile on;";
    $f[] = "\tsendfile_max_chunk 256k;";
    $f[] = "\ttcp_nopush on;";
    $f[] = "\ttcp_nodelay on;";
    $f[] = "\tserver_tokens off;";
    $dns = new resolv_conf();
    $sock = new sockets();
    if ($sock->dnsmasq_enabled()) {
        $resolver[] = "127.0.0.1";
    }
    if ($dns->MainArray["DNS1"] != null) {
        $resolver[] = $dns->MainArray["DNS1"];
    }
    if ($dns->MainArray["DNS2"] != null) {
        $resolver[] = $dns->MainArray["DNS2"];
    }
    if ($dns->MainArray["DNS3"] != null) {
        $resolver[] = $dns->MainArray["DNS3"];
    }
    $f[] = "\tresolver " . @implode(" ", $resolver) . ";";
    $f[] = "\tignore_invalid_headers on;";
    $f[] = "\tindex index.html;";
    $f[] = "\tadd_header X-CDN \"Served by myself\";";
    $q = new mysql_squid_builder();
    $sql = "SELECT * FROM nginx_caches  ORDER BY directory";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $directory = $ligne["directory"];
        @mkdir($directory, 0755, true);
        $unix->chown_func("www-data", "www-data", $directory);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: Nginx, cache `{$directory}`\n";
        }
        $f[] = "\tproxy_cache_path {$directory} levels={$ligne["levels"]} keys_zone={$ligne["keys_zone"]}:{$ligne["keys_zone_size"]}m max_size={$ligne["max_size"]}G  inactive={$ligne["inactive"]} loader_files={$ligne["loader_files"]} loader_sleep={$ligne["loader_sleep"]} loader_threshold={$ligne["loader_threshold"]};";
    }
    $f[] = "\tproxy_temp_path {$NginxProxyStorePath}/tmp/ 1 2;";
    $f[] = "\tproxy_cache_valid 404 10m;";
    $f[] = "\tproxy_cache_valid 400 501 502 503 504 1m;";
    $f[] = "\tproxy_cache_valid any 4320m;";
    $f[] = "\tproxy_cache_use_stale updating invalid_header error timeout http_404 http_500 http_502 http_503 http_504;";
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:67,代码来源:exec.nginx.php

示例3: CHECK_DNS_SYSTEMS

function CHECK_DNS_SYSTEMS()
{
    $unix = new unix();
    $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $BigTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".week.time";
    $pid = $unix->get_pid_from_file($pidFile);
    if ($unix->process_exists($pid)) {
        if ($unix->PROCCESS_TIME_MIN($pid, 10) < 2) {
            return;
        }
    }
    if ($GLOBALS["VERBOSE"]) {
        echo "pidtime ={$pidtime}\n";
    }
    @file_put_contents($pidFile, getmypid());
    $time = $unix->file_time_min($pidtime);
    if (!$GLOBALS["FORCE"]) {
        if ($time < 5) {
            Events("{$time}mn < 5mn ( use --force to bypass)");
            if ($GLOBALS["VERBOSE"]) {
                echo "{$time}mn < 5mn ( use --force to bypass)\n";
            }
            return;
        }
    }
    @unlink($pidtime);
    @file_put_contents($pidtime, time());
    $BigTimeEx = $unix->file_time_min($BigTime);
    if ($GLOBALS["VERBOSE"]) {
        echo "{$BigTimeEx}M for {$BigTime}\n";
    }
    if ($BigTimeEx > 4320) {
        $q = new mysql();
        @unlink($BigTimeEx);
        @file_put_contents($BigTimeEx, time());
        Events("DELETE FROM dnsperfs_week WHERE zDate<DATE_SUB(NOW(),INTERVAL 8 DAY)");
        $q->QUERY_SQL("DELETE QUICK FROM dnsperfs_week WHERE zDate<DATE_SUB(NOW(),INTERVAL 8 DAY)", "artica_events");
        $q->QUERY_SQL("OPTIMIZE TABLE dnsperfs_week", "artica_events");
    }
    $resolv = new resolv_conf();
    $q = new mysql_squid_builder();
    $sock = new sockets();
    include_once dirname(__FILE__) . "/ressources/externals/Net_DNS2/DNS2.php";
    include_once dirname(__FILE__) . "/ressources/class.resolv.conf.inc";
    $sql = "SELECT *  FROM dns_servers ORDER BY zOrder";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        ToSyslog("{$q->mysql_error}");
        return;
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $DNS[] = $ligne["dnsserver"];
    }
    $sock = new sockets();
    if ($sock->dnsmasq_enabled() == 1) {
        $DNS[] = "127.0.0.1";
    }
    $q = new mysql();
    $sql = "CREATE TABLE IF NOT EXISTS `dnsperfs` (\n\t\t\t\t`dnsserver` VARCHAR(128) PRIMARY KEY,\n\t\t\t\t`performance` FLOAT(5),\n\t\t\t\t `percent` smallint(2),\n\t\t\t\t `zDate` datetime\n\t\t\t\t ) ENGINE=MyISAM;";
    $q->QUERY_SQL($sql, 'artica_events');
    $sql = "CREATE TABLE IF NOT EXISTS `dnsperfs_week` (\n\t\t\t\t`dnsserver` VARCHAR(128),\n\t\t\t\t`performance` FLOAT(5),\n\t\t\t\t `percent` smallint(2),\n\t\t\t\t `zDate` datetime,\n\t\t\t\t KEY `zDate` (`zDate`),\n\t\t\t     KEY `dnsserver` (`dnsserver`)\n\t\t\t\t ) ENGINE=MyISAM;";
    $q->QUERY_SQL($sql, 'artica_events');
    $nameserver = explode("\n", @file_get_contents("/etc/resolv.conf"));
    while (list($index, $line) = each($nameserver)) {
        $line = trim($line);
        if ($line == null) {
            continue;
        }
        if (!preg_match("#^nameserver\\s+(.+)#i", $line, $re)) {
            continue;
        }
        $COMP[trim($re[1])] = true;
    }
    $q->QUERY_SQL("TRUNCATE TABLE `dnsperfs`", 'artica_events');
    //ref=518379
    if ($resolv->MainArray["DNS1"] != null) {
        $DNS[] = $resolv->MainArray["DNS1"];
    }
    if ($resolv->MainArray["DNS2"] != null) {
        $DNS[] = $resolv->MainArray["DNS2"];
    }
    if ($resolv->MainArray["DNS3"] != null) {
        $DNS[] = $resolv->MainArray["DNS3"];
    }
    $type = "A";
    $ipClass = new IP();
    $minperf = $sock->GET_INFO("DNSPerfsPointer");
    if (!is_numeric($minperf)) {
        $minperf = 301450;
    }
    while (list($index, $dnsA) = each($DNS)) {
        $COMP[$dnsA] = true;
    }
    while (list($dnsA, $none) = each($COMP)) {
        Events("Checks DNS {$dnsA}");
        if (!$ipClass->isIPAddress($dnsA)) {
            continue;
        }
        if ($GLOBALS["VERBOSE"]) {
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:exec.squid.watchdog.php

示例4: install_service_main

function install_service_main($G)
{
    $sock = new sockets();
    $unix = new unix();
    $php = $unix->LOCATE_PHP5_BIN();
    $INITD_PATH = "/etc/init.d/dnsmasq";
    $php5script = basename(__FILE__);
    $daemonbinLog = "DNSMasq for main";
    $daemon_path = $unix->find_program("dnsmasq");
    $EnableDNSMASQ = $sock->dnsmasq_enabled();
    $cmdline = @implode(" ", $G);
    if (count($G) < 2) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} Failed NO Tokens, Build config...\n";
        }
        return;
    }
    $f[] = "#!/bin/sh";
    $f[] = "### BEGIN INIT INFO";
    $f[] = "# Provides:       dnsmasq";
    $f[] = "# Required-Start: \$network \$remote_fs \$syslog";
    $f[] = "# Required-Stop:  \$network \$remote_fs \$syslog";
    $f[] = "# Default-Start:  2 3 4 5";
    $f[] = "# Default-Stop:   0 1 6";
    $f[] = "# Description:    DHCP and DNS server";
    $f[] = "### END INIT INFO";
    $f[] = "";
    $f[] = "set +e   # Don't exit on error status";
    $f[] = "";
    $f[] = "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin";
    $f[] = "DAEMON={$daemon_path}";
    $f[] = "NAME=dnsmasq";
    $f[] = "DESC=\"DNS forwarder and DHCP server\"";
    $f[] = "";
    $f[] = "# Most configuration options in /etc/default/dnsmasq are deprecated";
    $f[] = "# but still honoured.";
    $f[] = "ENABLED={$EnableDNSMASQ}";
    $f[] = "if [ -r /etc/default/\$NAME ]; then";
    $f[] = "\t. /etc/default/\$NAME";
    $f[] = "fi";
    $f[] = "";
    $f[] = "# Get the system locale, so that messages are in the correct language, and the ";
    $f[] = "# charset for IDN is correct";
    $f[] = "if [ -r /etc/default/locale ]; then";
    $f[] = "        . /etc/default/locale";
    $f[] = "        export LANG";
    $f[] = "fi";
    $f[] = "";
    $f[] = "test -x \$DAEMON || exit 0";
    $f[] = "";
    $f[] = "# Provide skeleton LSB log functions for backports which don't have LSB functions.";
    $f[] = "if [ -f /lib/lsb/init-functions ]; then";
    $f[] = "         . /lib/lsb/init-functions";
    $f[] = "else";
    $f[] = "         log_warning_msg () {";
    $f[] = "            echo \"\${@}.\"";
    $f[] = "         }";
    $f[] = "";
    $f[] = "         log_success_msg () {";
    $f[] = "            echo \"\${@}.\"";
    $f[] = "         }";
    $f[] = "";
    $f[] = "         log_daemon_msg () {";
    $f[] = "            echo -n \"\${1}: \$2\"";
    $f[] = "         }";
    $f[] = "";
    $f[] = "\t log_end_msg () {";
    $f[] = "            if [ \$1 -eq 0 ]; then";
    $f[] = "              echo \".\"";
    $f[] = "            elif [ \$1 -eq 255 ]; then";
    $f[] = "              /bin/echo -e \" (warning).\"";
    $f[] = "            else";
    $f[] = "              /bin/echo -e \" failed!\"";
    $f[] = "            fi";
    $f[] = "         }";
    $f[] = "fi";
    $f[] = "";
    $f[] = "# RESOLV_CONF:";
    $f[] = "# If the resolvconf package is installed then use the resolv conf file";
    $f[] = "# that it provides as the default.  Otherwise use /etc/resolv.conf as";
    $f[] = "# the default.";
    $f[] = "#";
    $f[] = "# If IGNORE_RESOLVCONF is set in /etc/default/dnsmasq or an explicit";
    $f[] = "# filename is set there then this inhibits the use of the resolvconf-provided";
    $f[] = "# information.";
    $f[] = "#";
    $f[] = "# Note that if the resolvconf package is installed it is not possible to ";
    $f[] = "# override it just by configuration in /etc/dnsmasq.conf, it is necessary";
    $f[] = "# to set IGNORE_RESOLVCONF=yes in /etc/default/dnsmasq.";
    $f[] = "";
    $f[] = "if [ ! \"\$RESOLV_CONF\" ] &&";
    $f[] = "   [ \"\$IGNORE_RESOLVCONF\" != \"yes\" ] &&";
    $f[] = "   [ -x /sbin/resolvconf ]";
    $f[] = "then";
    $f[] = "\tRESOLV_CONF=/var/run/dnsmasq/resolv.conf";
    $f[] = "fi";
    $f[] = "";
    $f[] = "for INTERFACE in \$DNSMASQ_INTERFACE; do";
    $f[] = "\tDNSMASQ_INTERFACES=\"\$DNSMASQ_INTERFACES -i \$INTERFACE\"";
    $f[] = "done";
//.........这里部分代码省略.........
开发者ID:articatech,项目名称:artica,代码行数:101,代码来源:exec.dnsmasq.php

示例5: details_tablerows

function details_tablerows()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_squid_builder();
    $squid = new squidbee();
    $sock = new sockets();
    $t = $_GET["t"];
    $search = '%';
    $table = "dns_servers";
    if (!$q->TABLE_EXISTS($table)) {
        $q->QUERY_SQL("CREATE TABLE `squidlogs`.`dns_servers` ( `ID` INT UNSIGNED AUTO_INCREMENT PRIMARY KEY ,\n\t\t\t\t `dnsserver` VARCHAR( 90 ) NOT NULL , \n\t\t\t\t `zOrder` SMALLINT( 2 ) NOT NULL ,\n\t\t\t\t INDEX (`zOrder`), \n\t\t\t\tUNIQUE KEY `dnsserver` (`dnsserver`) )");
    }
    $page = 1;
    $FORCE_FILTER = null;
    $total = 0;
    $enabled = 1;
    $SquidDNSUseSystem = intval($sock->GET_INFO("SquidDNSUseSystem"));
    $SquidDNSUseLocalDNSService = intval($sock->GET_INFO("SquidDNSUseLocalDNSService"));
    $LOCAL_ENABLED = 1;
    $SquidDNSUseSystem_icon = "ok-42.png";
    $SquidDNSUseSystem_color = "black";
    $SquidDNSUseLocalDNSService_icon = "ok-42.png";
    $SquidDNSUseLocalDNSService_color = "black";
    $TableMainColor = "black";
    $SquidDNSUseSystem_js = "Loadjs('{$MyPage}?SquidDNSUseSystem-js=yes')";
    $SquidDNSUseLocalDNSService_js = "Loadjs('{$MyPage}?SquidDNSUseLocalDNSService-js=yes')";
    if ($SquidDNSUseSystem == 0) {
        $SquidDNSUseSystem_icon = "danger42.png";
    }
    if ($SquidDNSUseLocalDNSService == 0) {
        $SquidDNSUseLocalDNSService_icon = "danger42.png";
        $LOCAL_ENABLED = 0;
    }
    if ($SquidDNSUseSystem == 1) {
        $TableMainColor = "#898989";
        $LOCAL_ENABLED = 0;
        $SquidDNSUseLocalDNSService_icon = "ok-42-grey.png";
        $SquidDNSUseLocalDNSService_color = "#898989";
    }
    if ($sock->dnsmasq_enabled() == 0) {
        $LOCAL_ENABLED = 0;
        $SquidDNSUseLocalDNSService_icon = "ok-42-grey.png";
        $SquidDNSUseLocalDNSService_color = "#898989";
        $SquidDNSUseLocalDNSService_js = "blur()";
    }
    if ($LOCAL_ENABLED == 1) {
        $SquidDNSUseSystem_color = "#898989";
    }
    $SquidDNSUseSystem_icon = imgsimple($SquidDNSUseSystem_icon, null, $SquidDNSUseSystem_js);
    $SquidDNSUseSystem_text = $tpl->_ENGINE_parse_body("{squid_use_local_system_dns}");
    $SquidDNSUseLocalDNSService_icon = imgsimple($SquidDNSUseLocalDNSService_icon, null, $SquidDNSUseLocalDNSService_js);
    $SquidDNSUseLocalDNSService_text = $tpl->_ENGINE_parse_body("{squid_use_local_service_dns}");
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $searchstring = string_to_flexquery();
    if ($searchstring != null) {
        $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER} {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $total = $ligne["TCOUNT"];
    } else {
        $sql = "SELECT COUNT(*) as TCOUNT FROM {$table}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $total = $ligne["TCOUNT"];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    if (is_numeric($rp)) {
        $limitSql = "LIMIT {$pageStart}, {$rp}";
    }
    $sql = "SELECT *  FROM {$table} WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}";
    $results = $q->QUERY_SQL($sql);
    $no_rule = $tpl->_ENGINE_parse_body("{no data}");
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total + 2;
    $data['rows'] = array();
    if (!$q->ok) {
        json_error_show($q->mysql_error . "<br>{$sql}");
    }
    $data['rows'][] = array('id' => "squid-dns-A", 'cell' => array("<center style='font-size:36px;color:{$SquidDNSUseSystem_color}'>{$SquidDNSUseSystem_icon}</center>", "<a href=\"javascript:blur();\" OnClick=\"javascript:{$SquidDNSUseSystem_js}\" \n\t\t\t\t\t\tstyle='font-size:36px;color:{$SquidDNSUseSystem_color};text-decoration:underline'>{$SquidDNSUseSystem_text}</span>", "<center style='font-size:36px;color:{$SquidDNSUseSystem_color}'>-</center>", "<center style='font-size:36px;color:{$SquidDNSUseSystem_color}'>-</center>", "<center style='font-size:36px;color:{$SquidDNSUseSystem_color}'>-</center>"));
    $data['rows'][] = array('id' => "squid-dns-A", 'cell' => array("<center style='font-size:36px;color:{$SquidDNSUseLocalDNSService_color}'>{$SquidDNSUseLocalDNSService_icon}</center>", "<a href=\"javascript:blur();\" OnClick=\"javascript:{$SquidDNSUseLocalDNSService_js}\" \n\t\t\t\t\tstyle='font-size:36px;color:{$SquidDNSUseLocalDNSService_color};;text-decoration:underline'>{$SquidDNSUseLocalDNSService_text} (127.0.0.1)</span>", "<center style='font-size:36px;color:{$SquidDNSUseLocalDNSService_color}'>-</center>", "<center style='font-size:36px;color:{$SquidDNSUseLocalDNSService_color}'>-</center>", "<center style='font-size:36px;color:{$SquidDNSUseLocalDNSService_color}'>-</center>"));
    $fontsize = "16";
    while ($ligne = mysql_fetch_assoc($results)) {
        $delete = imgtootltip('delete-42.png', '{delete}', "DnsDelete{$t}('{$ligne["dnsserver"]}')");
        $up = imgsimple("arrow-up-42.png", "", "SquidDNSUpDown('{$ligne['ID']}',1)");
        $down = imgsimple("arrow-down-42.png", "", "SquidDNSUpDown('{$ligne['ID']}',0)");
        $data['rows'][] = array('id' => "squid-dns-{$ligne["ID"]}", 'cell' => array("<center style='font-size:36px;color:{$TableMainColor}'>{$ligne["zOrder"]}</center>", "<span style='font-size:36px;color:{$TableMainColor}'>{$ligne["dnsserver"]}</span>", "<center style='font-size:12.5px'>{$up}</center>", "<center style='font-size:12.5px'>{$down}</center>", "<center style='font-size:12.5px'>{$delete}</center>"));
    }
    echo json_encode($data);
}
开发者ID:articatech,项目名称:artica,代码行数:99,代码来源:squid.dns.servers.php

示例6: build


//.........这里部分代码省略.........
                    $f[] = "\tif mem usage > {$prc}% for 5 cycles then restart";
                }
                $f[] = "\tif 5 restarts within 5 cycles then timeout";
                $f[] = "";
                if ($GLOBALS["OUTPUT"]) {
                    echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Squid-Cache...\n";
                }
                @file_put_contents("/etc/monit/conf.d/APP_SQUIDMAIN.monitrc", @implode("\n", $f));
            }
        }
    }
    // ********************************************************************************************************************
    $f = array();
    @unlink("/etc/monit/conf.d/APP_SQUIDDB.monitrc");
    if (is_dir("/opt/squidsql/data")) {
        if ($SQUIDEnable == 1) {
            $f = array();
            $f[] = "check process APP_SQUID_DB with pidfile /var/run/squid-db.pid";
            $f[] = "\tstart program = \"/etc/init.d/squid-db start --monit\"";
            $f[] = "\tstop program = \"/etc/init.d/squid-db stop --monit\"";
            $f[] = "\tif failed unixsocket /var/run/mysqld/squid-db.sock then restart";
            $f[] = "\tif 5 restarts within 5 cycles then timeout";
            $f[] = "";
            if ($GLOBALS["OUTPUT"]) {
                echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring Squid MySQL DB...\n";
            }
            @file_put_contents("/etc/monit/conf.d/APP_SQUIDDB.monitrc", @implode("\n", $f));
        }
    }
    // ********************************************************************************************************************
    $f = array();
    @unlink("/etc/monit/conf.d/APP_DNSMASQ.monitrc");
    if ($users->dnsmasq_installed) {
        $enabled = $sock->dnsmasq_enabled();
        if ($enabled == 1) {
            $f[] = "check process APP_DNSMASQ with pidfile /var/run/dnsmasq.pid";
            $f[] = "\tstart program = \"/etc/init.d/dnsmasq start --monit\"";
            $f[] = "\tstop program = \"/etc/init.d/dnsmasq stop --monit\"";
            $f[] = "\tif 5 restarts within 5 cycles then timeout";
            $f[] = "";
            if ($GLOBALS["OUTPUT"]) {
                echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring DnsMASQ...\n";
            }
            @file_put_contents("/etc/monit/conf.d/APP_DNSMASQ.monitrc", @implode("\n", $f));
        }
    }
    // ********************************************************************************************************************
    // ********************************************************************************************************************
    $f = array();
    @unlink("/etc/monit/conf.d/APP_CICAP.monitrc");
    if ($users->C_ICAP_INSTALLED) {
        if ($SQUIDEnable == 1) {
            $CicapEnabled = $sock->GET_INFO("CicapEnabled");
            if (!is_numeric($CicapEnabled)) {
                $CicapEnabled = 0;
            }
            if ($CicapEnabled == 1) {
                $f[] = "check process APP_C_ICAP with pidfile /var/run/c-icap/c-icap.pid";
                $f[] = "\tstart program = \"/etc/init.d/artica-postfix start cicap\"";
                $f[] = "\tstop program = \"/etc/init.d/artica-postfix stop cicap\"";
                $f[] = "\tif 5 restarts within 5 cycles then timeout";
                $f[] = "";
                if ($GLOBALS["OUTPUT"]) {
                    echo "Stopping......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} monitoring C-ICAP...\n";
                }
                @file_put_contents("/etc/monit/conf.d/APP_CICAP.monitrc", @implode("\n", $f));
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:67,代码来源:exec.monit.php

示例7: build

function build($aspid = false)
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
    $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
    if (!$aspid) {
        if (!$GLOBALS["FORCE"]) {
            $pid = @file_get_contents($pidfile);
            if ($unix->process_exists($pid, basename(__FILE__))) {
                writelogs("Already executed pid {$pid}, aborting...", "MAIN", __FILE__, __LINE__);
                die;
            }
            $time = $unix->file_time_min($pidtime);
            if ($time < 2) {
                if ($time > 0) {
                    if ($GLOBALS["OUTPUT"]) {
                        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["SERVICE_NAME"]} Current {$time}Mn Requested 2mn, schedule this task\n";
                    }
                    writelogs("Current {$time}Mn Requested 2mn, schedule this task", "MAIN", __FILE__, __LINE__);
                    $unix->THREAD_COMMAND_SET($unix->LOCATE_PHP5_BIN() . " " . __FILE__);
                }
                die;
            }
        }
        @unlink($pidtime);
        @file_put_contents($pidtime, time());
        @file_put_contents($pidfile, getmypid());
    }
    $Masterbin = $unix->find_program("dnsmasq");
    $users = new settings_inc();
    if (!$users->dnsmasq_installed) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} is not installed, aborting\n";
        writelogs("DNSMasq is not installed, aborting", "MAIN", __FILE__, __LINE__);
        return;
    }
    $sock = new sockets();
    $EnableDNSMASQ = $sock->dnsmasq_enabled();
    $EnableRemoteStatisticsAppliance = intval($sock->GET_INFO("EnableRemoteStatisticsAppliance"));
    $DNSMasqUseStatsAppliance = intval($sock->GET_INFO("DNSMasqUseStatsAppliance"));
    $EnableWebProxyStatsAppliance = intval($sock->GET_INFO("EnableWebProxyStatsAppliance"));
    $UnlockWebStats = intval($sock->GET_INFO("UnlockWebStats"));
    if ($UnlockWebStats == 1) {
        $EnableRemoteStatisticsAppliance = 0;
    }
    if ($EnableDNSMASQ == 0) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} DnsMasq is disabled\n";
        }
        return;
    }
    if ($EnableRemoteStatisticsAppliance == 1) {
        if ($DNSMasqUseStatsAppliance == 1) {
            writelogs("DNSMasq -> use Web statistics Appliance...", "MAIN", __FILE__, __LINE__);
            UseStatsAppliance();
            die;
        }
    }
    $php = $unix->LOCATE_PHP5_BIN();
    shell_exec("{$php} /usr/share/artica-postfix/exec.virtuals-ip.php --hosts");
    @file_put_contents("/etc/dnsmasq.conf.empty", "");
    $DNsServers = GetDNSSservers();
    $getdomains = getdomains();
    check_squid_inside();
    $LocalDNSMASQItems = $sock->GET_INFO('LocalDNSMASQItems');
    if (!is_numeric($LocalDNSMASQItems)) {
        $LocalDNSMASQItems = 250000;
    }
    $cf = new dnsmasq();
    $G = array();
    $G[] = "{$Masterbin}";
    $G[] = "--local-ttl=3600";
    $G[] = "--conf-file=/etc/dnsmasq.conf.empty";
    $G[] = "--pid-file=/var/run/dnsmasq.pid";
    $G[] = "--strict-order";
    $G[] = "--domain-needed";
    $G[] = "--expand-hosts";
    $G[] = "--bogus-priv";
    if ($DNsServers != null) {
        $G[] = $DNsServers;
    }
    if ($getdomains != null) {
        $G[] = $getdomains;
    }
    $G[] = "--cache-size={$LocalDNSMASQItems}";
    $G[] = "--filterwin2k";
    $G[] = "--log-facility=DAEMON";
    if ($cf->main_array["log-queries"] == "yes") {
        $G[] = "--log-queries";
    }
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} CONFIGURATOR " . count($G) . " line(s) LINE:" . __LINE__ . "\n";
    }
    $G = cachednshosts_records($G);
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} CONFIGURATOR " . count($G) . " line(s) LINE:" . __LINE__ . "\n";
    }
    @mkdir("/var/run/dnsmasq", 0755, true);
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]} CONFIGURATOR /etc/dnsmasq.cmdlines.array done\n";
    }
//.........这里部分代码省略.........
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:101,代码来源:exec.dnsmasq.php


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