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


PHP exec_background函数代码示例

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


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

示例1: upgrade_to_0_8_7h

function upgrade_to_0_8_7h()
{
    global $config;
    require_once $config["base_path"] . "/lib/poller.php";
    /* speed up the reindexing */
    $_columns = array_rekey(db_fetch_assoc("SHOW COLUMNS FROM host_snmp_cache"), "Field", "Field");
    if (!in_array("present", $_columns)) {
        db_install_execute("0.8.7h", "ALTER TABLE host_snmp_cache ADD COLUMN present tinyint NOT NULL DEFAULT '1' AFTER `oid`");
        db_install_execute("0.8.7h", "ALTER TABLE host_snmp_cache ADD INDEX present (present)");
        cacti_log(__FUNCTION__ . " upgrade table host_snmp_cache", false, "UPGRADE");
    }
    $_columns = array_rekey(db_fetch_assoc("SHOW COLUMNS FROM poller_item"), "Field", "Field");
    if (!in_array("present", $_columns)) {
        db_install_execute("0.8.7h", "ALTER TABLE poller_item ADD COLUMN present tinyint NOT NULL DEFAULT '1' AFTER `action`");
        db_install_execute("0.8.7h", "ALTER TABLE poller_item ADD INDEX present (present)");
        cacti_log(__FUNCTION__ . " upgrade table poller_item", false, "UPGRADE");
    }
    $_columns = array_rekey(db_fetch_assoc("SHOW COLUMNS FROM poller_reindex"), "Field", "Field");
    if (!in_array("present", $_columns)) {
        db_install_execute("0.8.7h", "ALTER TABLE poller_reindex ADD COLUMN present tinyint NOT NULL DEFAULT '1' AFTER `action`");
        db_install_execute("0.8.7h", "ALTER TABLE poller_reindex ADD INDEX present (present)");
        cacti_log(__FUNCTION__ . " upgrade table poller_reindex", false, "UPGRADE");
    }
    $_columns = array_rekey(db_fetch_assoc("SHOW COLUMNS FROM host"), "Field", "Field");
    if (!in_array("device_threads", $_columns)) {
        db_install_execute("0.8.7h", "ALTER TABLE host ADD COLUMN device_threads tinyint(2) unsigned NOT NULL DEFAULT '1' AFTER max_oids;");
        cacti_log(__FUNCTION__ . " upgrade table host", false, "UPGRADE");
    }
    $_keys = array_rekey(db_fetch_assoc("SHOW KEYS FROM data_template_rrd"), "Key_name", "Key_name");
    if (!in_array("duplicate_dsname_contraint", $_keys)) {
        db_install_execute("0.8.7h", "ALTER TABLE `data_template_rrd` ADD UNIQUE INDEX `duplicate_dsname_contraint` (`local_data_id`, `data_source_name`, `data_template_id`)");
        cacti_log(__FUNCTION__ . " upgrade table data_template_rrd", false, "UPGRADE");
    }
    /* update the reindex cache, as we now introduced more options for "index count changed" */
    $command_string = read_config_option("path_php_binary");
    $extra_args = "-q \"" . $config["base_path"] . "/cli/poller_reindex_hosts.php\" --id=all";
    exec_background($command_string, "{$extra_args}");
    cacti_log(__FUNCTION__ . " running {$command_string} {$extra_args}", false, "UPGRADE");
}
开发者ID:andrei1489,项目名称:cacti,代码行数:39,代码来源:0_8_7g_to_0_8_7h.php

示例2: hmib_poller_bottom

function hmib_poller_bottom()
{
    global $config;
    include_once $config["base_path"] . "/lib/poller.php";
    exec_background(read_config_option("path_php_binary"), " -q " . $config["base_path"] . "/plugins/hmib/poller_hmib.php -M");
}
开发者ID:khoimt,项目名称:cacti-sample,代码行数:6,代码来源:setup.php

示例3: run_command

function run_command($socket, $command, $multiprocess)
{
    global $config, $eol, $rrdtool_pipe, $rrd_path, $php_binary_path, $rrd_update_path, $rrdupdates_in_process;
    $output = 'OK';
    /* process the command, don't accept bad commands */
    if (substr_count(strtolower($command), 'quit')) {
        close_connection($socket, 'Host Disconnect Request Received.');
        return 'OK';
    } elseif (substr_count(strtolower(substr($command, 0, 10)), 'update')) {
        /* ok to run */
    } elseif (substr_count(strtolower(substr($command, 0, 10)), 'graph')) {
        /* ok to run */
    } elseif (substr_count(strtolower(substr($command, 0, 10)), 'tune')) {
        /* ok to run */
    } elseif (substr_count(strtolower(substr($command, 0, 10)), 'create')) {
        /* ok to run, check for structured paths */
        if (read_config_option('extended_paths') == 'on') {
            $parts = explode(' ', $command);
            $data_source_path = $parts[1];
            if (!is_dir(dirname($data_source_path))) {
                if (mkdir(dirname($data_source_path), 0775)) {
                    if ($config['cacti_server_os'] != 'win32') {
                        $owner_id = fileowner($config['rra_path']);
                        $group_id = filegroup($config['rra_path']);
                        if (chown(dirname($data_source_path), $owner_id) && chgrp(dirname($data_source_path), $group_id)) {
                            /* permissions set ok */
                        } else {
                            cacti_log("ERROR: Unable to set directory permissions for '" . dirname($data_source_path) . "'", FALSE);
                        }
                    }
                } else {
                    cacti_log("ERROR: Unable to create directory '" . dirname($data_source_path) . "'", FALSE);
                }
            }
        }
    } elseif (substr_count(strtolower(substr($command, 0, 10)), 'status')) {
        close_connection($socket, 'Server Status OK');
        return 'OK';
    } else {
        close_connection($socket, "WARNING: Unknown RRD Command '" . $command . "' This activity will be logged!! Goodbye.");
        return 'OK';
    }
    boost_svr_log("RRD Command '" . $command . "'");
    /* update/create the rrd */
    if (!$multiprocess) {
        boost_rrdtool_execute_internal($command, false, RRDTOOL_OUTPUT_STDOUT, 'BOOST SERVER');
    } else {
        /* store the correct information in the array */
        $rrdupdates_in_process[intval($socket)]['socket'] = $socket;
        if (strlen($rrd_update_path) && !substr_count($command, 'create ')) {
            $command = str_replace('update ', '', $command);
            exec_background($php_binary_path, 'boost_rrdupdate.php ' . intval($socket) . ' ' . $rrd_update_path . ' ' . $command);
        } else {
            exec_background($php_binary_path, 'boost_rrdupdate.php ' . intval($socket) . ' ' . $rrd_path . ' ' . $command);
        }
    }
    /* send the output back to the cleint if not multiprocess */
    if (!$multiprocess) {
        socket_write($socket, $output . $eol, strlen($output . $eol));
    }
}
开发者ID:MrWnn,项目名称:cacti,代码行数:61,代码来源:boost_server.php

示例4: boost_poller_bottom

function boost_poller_bottom()
{
    global $config;
    include_once $config['library_path'] . '/poller.php';
    chdir($config['base_path']);
    if (read_config_option('boost_rrd_update_enable') == 'on') {
        $command_string = read_config_option('path_php_binary');
        if (read_config_option('path_boost_log') != '') {
            if ($config['cacti_server_os'] == 'unix') {
                $extra_args = '-q ' . $config['base_path'] . '/poller_boost.php >> ' . read_config_option('path_boost_log') . ' 2>&1';
            } else {
                $extra_args = '-q ' . $config['base_path'] . '/poller_boost.php >> ' . read_config_option('path_boost_log');
            }
        } else {
            $extra_args = '-q ' . $config['base_path'] . '/poller_boost.php';
        }
        exec_background($command_string, $extra_args);
    }
}
开发者ID:MrWnn,项目名称:cacti,代码行数:19,代码来源:boost.php

示例5: syslog_poller_bottom

function syslog_poller_bottom()
{
    global $config;
    $command_string = read_config_option('path_php_binary');
    $extra_args = ' -q ' . $config['base_path'] . '/plugins/syslog/syslog_process.php';
    exec_background($command_string, $extra_args);
}
开发者ID:Cacti,项目名称:plugin_syslog,代码行数:7,代码来源:setup.php

示例6: poller_maintenance

function poller_maintenance()
{
    global $config;
    $command_string = trim(read_config_option('path_php_binary'));
    // If its not set, just assume its in the path
    if (trim($command_string) == '') {
        $command_string = 'php';
    }
    $extra_args = ' -q ' . $config['base_path'] . '/poller_maintenance.php';
    exec_background($command_string, $extra_args);
}
开发者ID:MrWnn,项目名称:cacti,代码行数:11,代码来源:functions.php

示例7: read_config_option

		}

		rrd_close($rrdtool_pipe);

		/* process poller commands */
		if (db_fetch_cell("select count(*) from poller_command") > 0) {
			$command_string = read_config_option("path_php_binary");
			$extra_args = "-q " . $config["base_path"] . "/poller_commands.php";
			exec_background($command_string, "$extra_args");
		}

		/* graph export */
		if ((read_config_option("export_type") != "disabled") && (read_config_option("export_timing") != "disabled")) {
			$command_string = read_config_option("path_php_binary");
			$extra_args = "-q " . $config["base_path"] . "/poller_export.php";
			exec_background($command_string, "$extra_args");
		}

		if ($method == "spine") {
			chdir(read_config_option("path_webroot"));
		}
	}else if (read_config_option('log_verbosity') >= POLLER_VERBOSITY_MEDIUM) {
		cacti_log("NOTE: There are no items in your poller for this polling cycle!", TRUE, "POLLER");
	}

	$poller_runs_completed++;

	/* record the start time for this loop */
	list($micro,$seconds) = split(" ", microtime());
	$loop_end = $seconds + $micro;
开发者ID:songchin,项目名称:Cacti,代码行数:30,代码来源:poller.php

示例8: reports_poller_bottom

/**
 * define the reports code that will be processed at the end of each polling event
 */
function reports_poller_bottom()
{
    global $config;
    include_once $config["base_path"] . "/lib/poller.php";
    $command_string = read_config_option("path_php_binary");
    $extra_args = "-q " . $config["base_path"] . "/poller_reports.php";
    exec_background($command_string, "{$extra_args}");
}
开发者ID:MrWnn,项目名称:cacti,代码行数:11,代码来源:reports.php

示例9: mikrotik_poller_bottom

function mikrotik_poller_bottom()
{
    global $config;
    include_once $config['base_path'] . '/lib/poller.php';
    exec_background(read_config_option('path_php_binary'), ' -q ' . $config['base_path'] . '/plugins/mikrotik/poller_mikrotik.php -M');
}
开发者ID:Cacti,项目名称:plugin_mikrotik,代码行数:6,代码来源:setup.php

示例10: read_config_option

     /* process poller commands */
     if (db_fetch_cell('SELECT COUNT(*) FROM poller_command') > 0) {
         $command_string = read_config_option('path_php_binary');
         $extra_args = '-q "' . $config['base_path'] . '/poller_commands.php"';
         exec_background($command_string, $extra_args);
     } else {
         /* no re-index or Rechache present on this run
          * in case, we have more PCOMMANDS than recaching, this has to be moved to poller_commands.php
          * but then we'll have to call it each time to make sure, stats are updated */
         db_execute("REPLACE INTO settings (name,value) VALUES ('stats_recache','RecacheTime:0.0 DevicesRecached:0')");
     }
     /* graph export */
     if (read_config_option('export_type') != 'disabled' && read_config_option('export_timing') != 'disabled') {
         $command_string = read_config_option('path_php_binary');
         $extra_args = '-q "' . $config['base_path'] . '/poller_export.php"';
         exec_background($command_string, $extra_args);
     }
     if ($method == 'spine') {
         chdir(read_config_option('path_webroot'));
     }
 } else {
     if (read_config_option('log_verbosity') >= POLLER_VERBOSITY_MEDIUM || $debug) {
         cacti_log('NOTE: There are no items in your poller for this polling cycle!', true, 'POLLER');
     }
 }
 $poller_runs_completed++;
 /* record the start time for this loop */
 list($micro, $seconds) = explode(' ', microtime());
 $loop_end = $seconds + $micro;
 $loop_time = $loop_end - $loop_start;
 if ($loop_time < $poller_interval) {
开发者ID:MrWnn,项目名称:cacti,代码行数:31,代码来源:poller.php

示例11: error_reporting

<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
$exe = 'php';
$args = '-c C:\\wamp\\bin\\apache\\Apache2.2.10\\bin\\php.ini socket.php';
exec_background($exe, $args);
function exec_background($exe, $args = '')
{
    if (substr(php_uname(), 0, 7) == "Windows") {
        pclose(popen("start \"bla\" \"" . $exe . "\" " . $args, "r"));
    } else {
        exec($exe . " " . $args . " > /dev/null &");
    }
}
echo date(DATE_ATOM);
开发者ID:vietlethanh,项目名称:KooKooBackEnd,代码行数:16,代码来源:create-socket.php

示例12: dsstats_poller_bottom

function dsstats_poller_bottom()
{
    global $config;
    include_once $config["library_path"] . "/poller.php";
    chdir($config["base_path"]);
    if (read_config_option('dsstats_enable') == 'on') {
        $command_string = read_config_option("path_php_binary");
        if (read_config_option("path_dsstats_log") != "") {
            if ($config["cacti_server_os"] == "unix") {
                $extra_args = "-q " . $config["base_path"] . "/poller_dsstats.php >> " . read_config_option("path_dsstats_log") . " 2>&1";
            } else {
                $extra_args = "-q " . $config["base_path"] . "/poller_dsstats.php >> " . read_config_option("path_dsstats_log");
            }
        } else {
            $extra_args = "-q " . $config["base_path"] . "/poller_dsstats.php";
        }
        exec_background($command_string, "{$extra_args}");
    }
}
开发者ID:MrWnn,项目名称:cacti,代码行数:19,代码来源:dsstats.php

示例13: run_command

function run_command($socket, $command, $multiprocess)
{
    global $config, $eol, $rrdtool_pipe, $rrd_path, $php_binary_path, $rrd_update_path, $rrdupdates_in_process;
    $output = "OK";
    /* process the command, don't accept bad commands */
    if (substr_count(strtolower($command), "quit")) {
        close_connection($socket, "Host Disconnect Request Received.");
        return "OK";
    } elseif (substr_count(strtolower(substr($command, 0, 10)), "update")) {
        /* ok to run */
    } elseif (substr_count(strtolower(substr($command, 0, 10)), "graph")) {
        /* ok to run */
    } elseif (substr_count(strtolower(substr($command, 0, 10)), "tune")) {
        /* ok to run */
    } elseif (substr_count(strtolower(substr($command, 0, 10)), "create")) {
        /* ok to run, check for structured paths */
        if (read_config_option("extended_paths") == "on") {
            $parts = explode(" ", $command);
            $data_source_path = $parts[1];
            if (!is_dir(dirname($data_source_path))) {
                if (mkdir(dirname($data_source_path), 0775)) {
                    if ($config["cacti_server_os"] != "win32") {
                        $owner_id = fileowner($config["rra_path"]);
                        $group_id = filegroup($config["rra_path"]);
                        if (chown(dirname($data_source_path), $owner_id) && chgrp(dirname($data_source_path), $group_id)) {
                            /* permissions set ok */
                        } else {
                            cacti_log("ERROR: Unable to set directory permissions for '" . dirname($data_source_path) . "'", FALSE);
                        }
                    }
                } else {
                    cacti_log("ERROR: Unable to create directory '" . dirname($data_source_path) . "'", FALSE);
                }
            }
        }
    } elseif (substr_count(strtolower(substr($command, 0, 10)), "status")) {
        close_connection($socket, "Server Status OK");
        return "OK";
    } else {
        close_connection($socket, "WARNING: Unknown RRD Command '" . $command . "' This activity will be logged!! Goodbye.");
        return "OK";
    }
    boost_svr_log("RRD Command '" . $command . "'");
    /* update/create the rrd */
    if (!$multiprocess) {
        boost_rrdtool_execute_internal($command, false, RRDTOOL_OUTPUT_STDOUT, "BOOST SERVER");
    } else {
        /* store the correct information in the array */
        $rrdupdates_in_process[intval($socket)]["socket"] = $socket;
        if (strlen($rrd_update_path) && !substr_count($command, "create ")) {
            $command = str_replace("update ", "", $command);
            exec_background($php_binary_path, "plugins/boost/boost_rrdupdate.php " . intval($socket) . " " . $rrd_update_path . " " . $command);
        } else {
            exec_background($php_binary_path, "plugins/boost/boost_rrdupdate.php " . intval($socket) . " " . $rrd_path . " " . $command);
        }
    }
    /* send the output back to the cleint if not multiprocess */
    if (!$multiprocess) {
        socket_write($socket, $output . $eol, strlen($output . $eol));
    }
}
开发者ID:resmon,项目名称:resmon-cacti,代码行数:61,代码来源:boost_server.php

示例14: mactrack_poller_bottom

function mactrack_poller_bottom()
{
    global $config;
    include_once $config['base_path'] . '/lib/poller.php';
    include_once $config['base_path'] . '/lib/data_query.php';
    include_once $config['base_path'] . '/lib/graph_export.php';
    include_once $config['base_path'] . '/lib/rrd.php';
    $command_string = read_config_option('path_php_binary');
    $extra_args = '-q ' . $config['base_path'] . '/plugins/mactrack/poller_mactrack.php';
    exec_background($command_string, $extra_args);
}
开发者ID:Cacti,项目名称:plugin_mactrack,代码行数:11,代码来源:setup.php

示例15: collect_mactrack_data


//.........这里部分代码省略.........

							/* create the mac address */
							$mac = $mac_ad[0] . $delim . $mac_ad[1] . $delim . $mac_ad[2] . $delim . $mac_ad[3] . $delim . $mac_ad[4] . $delim . $mac_ad[5];

							/* update the array */
							$mac_ip_dns[$mac]["ip"]  = $line[1];
							$mac_ip_dns[$mac]["dns"] = $line[3];
						}
					}
					fclose($arp_dat);

					mactrack_debug("ARPWATCH: IP, DNS & MAC collection complete with ArpWatch");
				}else{
					cacti_log("ERROR: cannot open file ArpWatch database '$arp_db'");exit;
				}
			}
		}

		/* scan through all devices */
		$j = 0;
		$i = 0;
		$last_time = strtotime("now");
		$processes_available = $concurrent_processes;
		while ($j < $total_devices) {
			/* retreive the number of concurrent mac_track processes to run */
			/* default to 10 for now */
			$concurrent_processes = db_fetch_cell("SELECT value FROM settings WHERE name='mt_processes'");

			for ($i = 0; $i < $processes_available; $i++) {
				if (($j+$i) >= $total_devices) break;

				$extra_args = " -q " . $config["base_path"] . "/plugins/mactrack/mactrack_scanner.php -id=" . $device_ids[$i+$j]["device_id"] . $e_debug;
				mactrack_debug("CMD: " . $command_string . $extra_args);
				exec_background($command_string, $extra_args);
			}
			$j = $j + $i;

			/* launch the dns resolver if it hasn't been yet */
			if (($dns_resolver_required) && (!$resolver_launched)) {
				sleep(2);
				exec_background($command_string, " -q " . $config["base_path"] . "/plugins/mactrack/mactrack_resolver.php" . $e_debug . $e_site);
				$resolver_launched = TRUE;
				mactrack_debug("DNS Resolver process launched");
			}

			mactrack_debug("A process cycle launch just completed.");

			/* wait the correct number of seconds for proccesses prior to
			   attempting to update records */
			sleep(2);
			$current_time = strtotime("now");
			if (($current_time - $last_time) > read_config_option("mt_dns_prime_interval")) {
				/* resolve some ip's to mac addresses to let the resolver knock them out */
				db_execute("UPDATE mac_track_temp_ports
							INNER JOIN mac_track_ips
							ON (mac_track_temp_ports.mac_address=mac_track_ips.mac_address
							AND mac_track_temp_ports.site_id=mac_track_ips.site_id)
							SET mac_track_temp_ports.ip_address=mac_track_ips.ip_address,
							mac_track_temp_ports.updated=1
							WHERE mac_track_temp_ports.updated=0 AND mac_track_ips.scan_date='$scan_date'");
				mactrack_debug("Interum IP addresses to MAC addresses association pass complete.");

				$last_time = $current_time;
			}

			$processes_running = db_fetch_cell("SELECT count(*) FROM mac_track_processes");
开发者ID:avillaverdec,项目名称:cacti,代码行数:67,代码来源:poller_mactrack_backup.php


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