本文整理汇总了PHP中mwexec_bg函数的典型用法代码示例。如果您正苦于以下问题:PHP mwexec_bg函数的具体用法?PHP mwexec_bg怎么用?PHP mwexec_bg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mwexec_bg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unset
if ($a_graphs[$graphid]) {
unset($a_graphs[$graphid]);
$a_mailreports[$id]['row'] = $a_graphs;
write_config();
header("Location: status_mail_report_edit.php?id={$id}");
exit;
}
}
$frequencies = array("daily", "weekly", "monthly");
$daysofweek = array("" => "", "0" => "sunday", "1" => "monday", "2" => "tuesday", "3" => "wednesday", "4" => "thursday", "5" => "friday", "6" => "saturday");
$dayofmonth = array("", "1", "15");
if ($_POST) {
unset($_POST['__csrf_magic']);
$pconfig = $_POST;
if ($_POST['Submit'] == "Send Now") {
mwexec_bg("/usr/local/bin/mail_reports_generate.php {$id}");
header("Location: status_mail_report_edit.php?id={$id}");
exit;
}
$friendly = "";
// Default to midnight if unset/invalid.
$pconfig['timeofday'] = isset($pconfig['timeofday']) ? $pconfig['timeofday'] : 0;
$friendlytime = sprintf("%02d:00", $pconfig['timeofday']);
$friendly = "Daily at {$friendlytime}";
// If weekly, check for day of week
if ($pconfig['frequency'] == "weekly") {
$pconfig['dayofweek'] = isset($pconfig['dayofweek']) ? $pconfig['dayofweek'] : 0;
$friendly = "Weekly, on {$daysofweek[$pconfig['dayofweek']]} at {$friendlytime}";
} else {
if (isset($pconfig['dayofweek'])) {
unset($pconfig['dayofweek']);
示例2: start_installation
function start_installation()
{
global $g, $fstype, $savemsg;
if (file_exists("/tmp/install_complete")) {
return;
}
$ps_running = exec("/bin/ps awwwux | /usr/bin/grep -v grep | /usr/bin/grep 'sh /tmp/installer.sh'");
if ($ps_running) {
return;
}
$fd = fopen("/tmp/installer.sh", "w");
if (!$fd) {
die(gettext("Could not open /tmp/installer.sh for writing"));
exit;
}
fwrite($fd, "/bin/rm /tmp/.pc-sysinstall/pc-sysinstall.log 2>/dev/null\n");
fwrite($fd, "/usr/sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh -c /usr/sbin/pc-sysinstall/examples/pfSense-install.cfg \n");
fwrite($fd, "/bin/chmod a+rx /usr/local/bin/after_installation_routines.sh\n");
fwrite($fd, "cd / && /usr/local/bin/after_installation_routines.sh\n");
fwrite($fd, "/bin/mkdir /mnt/tmp\n");
fwrite($fd, "/usr/bin/touch /tmp/install_complete\n");
fclose($fd);
exec("/bin/chmod a+rx /tmp/installer.sh");
mwexec_bg("/bin/sh /tmp/installer.sh");
}
示例3: header
header("Pragma: no-cache"); // HTTP/1.0
*/
require_once "guiconfig.inc";
class QueueStats
{
public $queuename;
public $queuelength;
public $pps;
public $bandwidth;
public $borrows;
public $suspends;
public $drops;
}
if (!file_exists("{$g['varrun_path']}/qstats.pid") || !isvalidpid("{$g['varrun_path']}/qstats.pid")) {
/* Start in the background so we don't hang up the GUI */
mwexec_bg("/usr/local/sbin/qstats -p {$g['varrun_path']}/qstats.pid");
/* Give it a moment to start up */
sleep(1);
}
$fd = @fsockopen("unix://{$g['varrun_path']}/qstats");
if (!$fd) {
$error = gettext("Something wrong happened during communication with stat gathering.");
} else {
$stats = "";
while (!feof($fd)) {
$stats .= fread($fd, 4096);
}
fclose($fd);
@file_put_contents("{$g['tmp_path']}/qstats", $stats);
$altqstats = @parse_xml_config("{$g['tmp_path']}/qstats", array("altqstats"));
if ($altqstats == -1) {
示例4: elseif
if (is_numeric($pconfig['filterdescriptions']) && $pconfig['filterdescriptions'] > 0) {
$config['syslog']['filterdescriptions'] = $pconfig['filterdescriptions'];
} elseif (isset($config['syslog']['filterdescriptions'])) {
unset($config['syslog']['filterdescriptions']);
}
$config['rrd']['enable'] = !empty($pconfig['rrdenable']);
write_config();
$retval = 0;
$retval = system_syslogd_start();
if ($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock']) || $oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass']) || $oldnologbogons !== isset($config['syslog']['nologbogons']) || $oldnologprivatenets !== isset($config['syslog']['nologprivatenets'])) {
$retval |= filter_configure();
}
$savemsg = get_std_save_message();
if ($oldnologlighttpd !== isset($config['syslog']['nologlighttpd'])) {
log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
mwexec_bg('/usr/local/etc/rc.restart_webgui 2');
$savemsg .= "<br />" . gettext("WebGUI process is restarting.");
}
filter_pflog_start();
enable_rrd_graphing();
setup_gateways_monitor();
}
}
}
legacy_html_escape_form_data($pconfig);
$closehead = false;
include "head.inc";
?>
示例5: gettext
if ($pkg_interface != "console") {
$static_output .= gettext("Finished rebuilding Suricata configuration from saved settings.\n");
update_output_window($static_output);
}
log_error(gettext("[Suricata] Finished rebuilding installation from saved settings..."));
// Only try to start Suricata if not in reboot
if (!$g['booting']) {
if ($pkg_interface != "console") {
update_status(gettext("Starting Suricata using rebuilt configuration..."));
$static_output .= gettext("Starting Suricata using the rebuilt configuration...");
update_output_window($static_output);
mwexec_bg("{$rcdir}suricata.sh start");
$static_output .= gettext(" done.\n");
update_output_window($static_output);
} else {
mwexec_bg("{$rcdir}suricata.sh start");
}
}
}
// If this is first install and "forcekeepsettings" is empty,
// then default it to 'on'.
if (empty($config['installedpackages']['suricata']['config'][0]['forcekeepsettings'])) {
$config['installedpackages']['suricata']['config'][0]['forcekeepsettings'] = 'on';
}
// Finished with file system mods, so remount it read-only
conf_mount_ro();
// Update Suricata package version in configuration
$config['installedpackages']['suricata']['config'][0]['suricata_config_ver'] = $config['installedpackages']['package'][get_pkg_id("suricata")]['version'];
write_config("Suricata pkg v{$config['installedpackages']['package'][get_pkg_id("suricata")]['version']}: post-install configuration saved.");
// Done with post-install, so clear flag
unset($g['suricata_postinstall']);
示例6: basename
exit;
}
}
if ($_GET['deletefile']) {
$filename = basename($_GET['deletefile']);
if (file_exists("/root/{$filename}") && preg_match("/pfSense-full-backup-\\d+-\\d+\\.tgz/", $filename) == 1) {
unlink("/root/" . $filename);
$savemsg = htmlspecialchars($filename) . " " . gettext("has been deleted.");
} else {
$savemsg = htmlspecialchars($filename) . " " . gettext("has not been been deleted (invalid backup file or file does not exist).");
}
}
if ($_POST['restorefile']) {
$filename = basename($_POST['restorefile']);
if (file_exists("/root/{$filename}") && preg_match("/pfSense-full-backup-\\d+-\\d+\\.tgz/", $filename) == 1) {
mwexec_bg("/etc/rc.restore_full_backup /root/" . escapeshellcmd($filename));
$savemsg = gettext("The firewall is currently restoring") . " " . htmlspecialchars($filename);
} else {
$savemsg = htmlspecialchars($filename) . " " . gettext("has not been been restored (invalid backup file or file does not exist).");
}
}
$pgtitle = array(gettext("Diagnostics"), gettext("Restore full backup"));
include "head.inc";
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php
include "fbegin.inc";
if ($input_errors) {
print_input_errors($input_errors);
}
示例7: ipsec_get_phase1
include "head.inc";
require_once "ipsec.inc";
if ($_GET['act'] == 'connect') {
if (ctype_digit($_GET['ikeid'])) {
$ph1ent = ipsec_get_phase1($_GET['ikeid']);
if (!empty($ph1ent)) {
if (empty($ph1ent['iketype']) || $ph1ent['iketype'] == 'ikev1') {
$ph2entries = ipsec_get_number_of_phase2($_GET['ikeid']);
for ($i = 0; $i < $ph2entries; $i++) {
$connid = escapeshellarg("con{$_GET['ikeid']}00{$i}");
mwexec("/usr/local/sbin/ipsec down {$connid}");
mwexec_bg("/usr/local/sbin/ipsec up {$connid}");
}
} else {
mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']));
mwexec_bg("/usr/local/sbin/ipsec up con" . escapeshellarg($_GET['ikeid']));
}
}
}
} else {
if ($_GET['act'] == 'ikedisconnect') {
if (ctype_digit($_GET['ikeid'])) {
if (!empty($_GET['ikesaid']) && ctype_digit($_GET['ikesaid'])) {
mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']) . "[" . escapeshellarg($_GET['ikesaid']) . "]");
} else {
mwexec("/usr/local/sbin/ipsec down con" . escapeshellarg($_GET['ikeid']));
}
}
} else {
if ($_GET['act'] == 'childdisconnect') {
if (ctype_digit($_GET['ikeid'])) {
示例8: mwexec_bg
if (file_exists(HVDEF_HAVP_STARTUP_SCRIPT)) {
mwexec_bg(HVDEF_HAVP_STARTUP_SCRIPT . " start");
sleep(3);
}
/* Restart service */
} elseif ($_POST['restart'] != '') {
// restart_service($_POST['restart']);
if (file_exists(HVDEF_HAVP_STARTUP_SCRIPT)) {
mwexec_bg(HVDEF_HAVP_STARTUP_SCRIPT . " restart");
sleep(3);
}
/* Stop service */
} elseif ($_POST['stop'] != '') {
// stop_service($_POST['stop']);
if (file_exists(HVDEF_HAVP_STARTUP_SCRIPT)) {
mwexec_bg(HVDEF_HAVP_STARTUP_SCRIPT . " stop");
sleep(3);
}
}
/* Scan start */
if ($_POST['scanpath'] != '') {
$scandir = $_POST['scanpath'];
if (function_exists("start_antivirus_scanner")) {
start_antivirus_scanner($scandir);
}
}
/* Start AV Update */
if ($_POST['startupdate'] != '') {
if (function_exists("havp_update_AV")) {
havp_update_AV();
}
示例9: reboot
/**
* Wrapper for rc.reboot
*
* @param string $username
* @param string $password
*
* @return bool
*/
public function reboot($username, $password)
{
$this->auth($username, $password);
mwexec_bg("/etc/rc.reboot");
return true;
}
示例10: update_output_window
if (!empty($config['installedpackages']['snortglobal']['dashboard_widget']) && stristr($config['widgets']['sequence'], "snort_alerts-container") === FALSE) {
$config['widgets']['sequence'] .= "," . $config['installedpackages']['snortglobal']['dashboard_widget'];
}
$rebuild_rules = false;
if ($pkg_interface != "console") {
update_output_window(gettext("Finished rebuilding Snort configuration files..."));
}
log_error(gettext("[Snort] Finished rebuilding installation from saved settings..."));
/* Only try to start Snort if not in reboot */
if (!$g['booting']) {
if ($pkg_interface != "console") {
update_status(gettext("Starting Snort using rebuilt configuration..."));
mwexec_bg("{$rcdir}snort.sh start");
update_output_window(gettext("Snort is starting as a background task using the rebuilt configuration..."));
} else {
mwexec_bg("{$rcdir}snort.sh start");
}
}
}
/* We're finished with conf partition mods, return to read-only */
conf_mount_ro();
/* If an existing Snort Dashboard Widget container is not found, */
/* then insert our default Widget Dashboard container. */
if (stristr($config['widgets']['sequence'], "snort_alerts-container") === FALSE) {
$config['widgets']['sequence'] .= ",{$snort_widget_container}";
}
/* Update Snort package version in configuration */
$config['installedpackages']['snortglobal']['snort_config_ver'] = "3.2.6";
write_config("Snort pkg v3.2.6: post-install configuration saved.");
/* Done with post-install, so clear flag */
unset($g['snort_postinstall']);
示例11: run_plugins
run_plugins("/usr/local/pkg/firmware_upgrade");
/* Check for input errors, firmware locks, warnings, then check for firmware if sig_override is set */
if (!$input_errors && !is_subsystem_dirty('firmwarelock') && (!$sig_warning || $_POST['sig_override'])) {
if (file_exists("{$g['upload_path']}/firmware.tgz")) {
/* fire up the update script in the background */
mark_subsystem_dirty('firmwarelock');
$savemsg = gettext("The firmware is now being updated. The firewall will reboot automatically.");
if (stristr($_FILES['ulfile']['name'], "nanobsd") or $_POST['isnano'] == "yes") {
mwexec_bg("/etc/rc.firmware pfSenseNanoBSDupgrade {$g['upload_path']}/firmware.tgz");
} else {
if ($g['platform'] == "nanobsd") {
$whichone = "pfSenseNanoBSDupgrade";
} else {
$whichone = "pfSenseupgrade";
}
mwexec_bg("/etc/rc.firmware {$whichone} {$g['upload_path']}/firmware.tgz");
unset($whichone);
}
} else {
$savemsg = sprintf(gettext("Firmware image missing or other error, please try again %s."), $errortext);
}
}
}
}
}
}
}
$pgtitle = array(gettext("System"), gettext("Firmware"));
include "head.inc";
if ($input_errors) {
print_input_errors($input_errors);
示例12: services_igmpproxy_configure
case 'igmpproxy':
services_igmpproxy_configure();
break;
case 'miniupnpd':
upnp_action('start');
break;
case 'racoon':
vpn_ipsec_force_reload();
break;
case 'openvpn':
$vpnmode = $_GET['vpnmode'];
if ($vpnmode == "server" || $vpnmode == "client") {
$id = $_GET['id'];
$configfile = "{$g['varetc_path']}/openvpn/{$vpnmode}{$id}.conf";
if (file_exists($configfile)) {
mwexec_bg("/usr/local/sbin/openvpn --config {$configfile}");
}
}
break;
case 'relayd':
relayd_configure();
break;
default:
start_service($_GET['service']);
break;
}
$savemsg = sprintf(gettext("%s has been started."), htmlspecialchars($_GET['service']));
sleep(5);
}
/* stop service */
if ($_GET['mode'] == "stopservice" && !empty($_GET['service'])) {
示例13: start_capture
/**
* start capture operation
* @param array $option, options to pass to tpcdump (interface, promiscuous, snaplen, fam, host, proto, port)
*/
function start_capture($options)
{
$cmd_opts = array();
$filter_opts = array();
$intf = get_real_interface($options['interface']);
$cmd_opts[] = '-i ' . $intf;
if (empty($options['promiscuous'])) {
// disable promiscuous mode
$cmd_opts[] = '-p';
}
if (!empty($options['snaplen']) && is_numeric($options['snaplen'])) {
// setup Packet Length
$cmd_opts[] = '-s ' . $options['snaplen'];
}
if (!empty($options['count']) && is_numeric($options['count'])) {
// setup count
$cmd_opts[] = '-c ' . $options['count'];
}
if (!empty($options['fam']) && in_array($options['fam'], array('ip', 'ip6'))) {
// filter address family
$filter_opts[] = $options['fam'];
}
if (!empty($options['proto'])) {
// filter protocol
$filter_opts[] = $options['proto'];
}
if (!empty($options['host'])) {
// filter host argument
$filter = '';
$prev_token = '';
foreach (explode(' ', $options['host']) as $token) {
if (in_array(trim($token), array('and', 'or'))) {
$filter .= $token;
} elseif (is_ipaddr($token)) {
$filter .= "host " . $prev_token . " " . $token;
} elseif (is_subnet($token)) {
$filter .= "net " . $prev_token . " " . $token;
}
if (trim($token) == 'not') {
$prev_token = 'not';
} else {
$prev_token = '';
}
$filter .= " ";
}
$filter_opts[] = "( " . $filter . " )";
}
if (!empty($options['port'])) {
// filter port
$filter_opts[] = "port " . str_replace("!", "not ", $options['port']);
}
if (!empty($intf)) {
$cmd = '/usr/sbin/tcpdump ';
$cmd .= implode(' ', $cmd_opts);
$cmd .= ' -w /root/packetcapture.cap ';
$cmd .= " " . escapeshellarg(implode(' and ', $filter_opts));
//delete previous packet capture if it exists
if (file_exists('/root/packetcapture.cap')) {
unlink('/root/packetcapture.cap');
}
mwexec_bg($cmd);
}
}
示例14: TORT
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
require_once 'config.inc';
require_once 'util.inc';
$pf_version = substr(trim(file_get_contents("/etc/version")), 0, 3);
if ($pf_version > 2.0) {
define('SQUID_LOCALBASE', '/usr/pbi/squid-' . php_uname("m"));
} else {
define('SQUID_LOCALBASE', '/usr/local');
}
$settings = $config['installedpackages']['squidcache']['config'][0];
// Only check the cache if Squid is actually caching.
// If there is no cache then quietly do nothing.
if ($settings['harddisk_cache_system'] != "null") {
$cachedir = $settings['harddisk_cache_location'] ? $settings['harddisk_cache_location'] : '/var/squid/cache';
$swapstate = $cachedir . '/swap.state';
$disktotal = disk_total_space(dirname($cachedir));
$diskfree = disk_free_space(dirname($cachedir));
$diskusedpct = round(($disktotal - $diskfree) / $disktotal * 100);
$swapstate_size = filesize($swapstate);
$swapstate_pct = round($swapstate_size / $disktotal * 100);
// If the swap.state file is taking up more than 75% disk space,
// or the drive is 90% full and swap.state is larger than 1GB,
// kill it and initiate a rotate to write a fresh copy.
if ($swapstate_pct > 75 || $diskusedpct > 90 && $swapstate_size > 1024 * 1024 * 1024) {
mwexec_bg("/bin/rm {$swapstate}; " . SQUID_LOCALBASE . "/sbin/squid -k rotate");
log_error(gettext(sprintf("Squid swap.state file exceeded size limits. Removing and rotating. File was %d bytes, %d%% of total disk space.", $swapstate_size, $swapstate_pct)));
}
}
示例15: pfb_cron_update
function pfb_cron_update($type)
{
global $pfb;
// Query for any active pfBlockerNG CRON jobs
exec('/bin/ps -wx', $result_cron);
if (preg_grep("/pfblockerng[.]php\\s+?(cron|update)/", $result_cron)) {
pfbupdate_status(gettext("Force {$type} Terminated - Failed due to Active Running Task. Click 'View' for running process"));
exit;
}
if (!file_exists("{$pfb['log']}")) {
touch("{$pfb['log']}");
}
// Update status window with correct task
if ($type == 'update') {
pfbupdate_status(gettext('Running Force Update Task'));
} elseif ($type == 'reload') {
$reload_type = htmlspecialchars($_POST['rmode']);
pfbupdate_status(gettext("Running Force Reload Task - {$reload_type}"));
switch ($reload_type) {
case 'IP':
$type = 'updateip';
break;
case 'DNSBL':
$type = 'updatednsbl';
rmdir_recursive("{$pfb['dnsdir']}");
break;
case 'All':
default:
$type = 'update';
rmdir_recursive("{$pfb['dnsdir']}");
}
} else {
pfbupdate_status(gettext('Running Force CRON Task'));
}
// Remove any existing pfBlockerNG CRON Jobs
install_cron_job('pfblockerng.php cron', false);
// Execute PHP process in the background
mwexec_bg("/usr/local/bin/php /usr/local/www/pfblockerng/pfblockerng.php {$type} >> {$pfb['log']} 2>&1");
// Execute Live Tail function
pfb_livetail($pfb['log'], 'force');
}