From c89609705be6271e6a302d7c1e08e736c247de43 Mon Sep 17 00:00:00 2001 From: Ermal Date: Mon, 6 Sep 2010 13:03:58 +0000 Subject: Fix ntpd starting at boot time and also status->services checking/stop/start/restart display. Previously ntpd would not start at all either though it should. --- etc/inc/system.inc | 7 ++----- usr/local/www/status_services.php | 11 ++++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 8ecc90d..09f1b98 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -1112,7 +1112,7 @@ function system_timezone_configure() { function system_ntp_configure() { global $config, $g; - $syscfg = $config['system']; + $syscfg =& $config['system']; /* open configuration for wrting or bail */ $fd = fopen("{$g['varetc_path']}/ntpd.conf","w"); @@ -1152,16 +1152,13 @@ function system_ntp_configure() { /* if openntpd is running, kill it */ while(is_process_running("ntpd")) { - mwexec("/usr/bin/killall ntpd", true); + killbyname("ntpd"); } /* if /var/empty does not exist, create it */ if(!is_dir("/var/empty")) exec("/bin/mkdir -p /var/empty && chmod ug+rw /var/empty/."); - if($g['booting']) - return; - /* start opentpd, set time now and use /var/etc/ntpd.conf */ exec("/usr/local/sbin/ntpd -s -f {$g['varetc_path']}/ntpd.conf"); diff --git a/usr/local/www/status_services.php b/usr/local/www/status_services.php index 96c49c5..584c8bc 100755 --- a/usr/local/www/status_services.php +++ b/usr/local/www/status_services.php @@ -66,6 +66,7 @@ if($_GET['mode'] == "restartservice" and !empty($_GET['service'])) { captiveportal_init_webgui(); break; case 'ntpd': + case 'openntpd': system_ntp_configure(); break; case 'bsnmpd': @@ -113,6 +114,7 @@ if($_GET['mode'] == "startservice" and !empty($_GET['service'])) { captiveportal_init_webgui(); break; case 'ntpd': + case 'openntpd': system_ntp_configure(); break; case 'bsnmpd': @@ -160,6 +162,9 @@ if($_GET['mode'] == "stopservice" && !empty($_GET['service'])) { case 'ntpd': killbyname("ntpd"); break; + case 'openntpd': + killbyname("openntpd"); + break; case 'bsnmpd': killbypid("{$g['varrun_path']}/snmpd.pid"); break; @@ -181,9 +186,6 @@ if($_GET['mode'] == "stopservice" && !empty($_GET['service'])) { case 'miniupnpd': upnp_action('stop'); break; - case 'openntpd': - killbyname("openntpd"); - break; case 'sshd': killbyname("sshd"); break; @@ -323,8 +325,7 @@ if (isset($config['ipsec']['enable'])) { foreach (array('server', 'client') as $mode) { if (is_array($config['openvpn']["openvpn-{$mode}"])) { - foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $settings) { - $setting =& $config['openvpn']["openvpn-{$mode}"][$id]; + foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $setting) { if (!isset($setting['disable'])) { $pconfig = array(); $pconfig['name'] = "openvpn"; -- cgit v1.1