summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-04-04 17:40:11 -0300
committerRenato Botelho <renato@netgate.com>2016-04-04 17:40:11 -0300
commit5a758355ec9a20ff75c9191b6915df64255fb8be (patch)
tree5249a1d9269008c8f434eb1919beca0f9699f9dc /src
parent67c934440521e8081d90850f4a10a40e82603db3 (diff)
downloadpfsense-5a758355ec9a20ff75c9191b6915df64255fb8be.zip
pfsense-5a758355ec9a20ff75c9191b6915df64255fb8be.tar.gz
Ticket #6053
- Do not call ntpdate before start ntpd, ntpd -g parameter is enough - Deprecate /usr/local/sbin/ntpdate_sync_once.sh - Remove system_ntp_configure parameter and always start ntpd
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/system.inc7
-rw-r--r--src/etc/pfSense.obsoletedfiles1
-rwxr-xr-xsrc/etc/rc.bootup6
-rwxr-xr-xsrc/usr/local/sbin/ntpdate_sync_once.sh46
4 files changed, 4 insertions, 56 deletions
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc
index c44dfab..dc8f902 100644
--- a/src/etc/inc/system.inc
+++ b/src/etc/inc/system.inc
@@ -1572,7 +1572,7 @@ function system_ntp_setup_pps($serialport) {
}
-function system_ntp_configure($start_ntpd=true) {
+function system_ntp_configure() {
global $config, $g;
$driftfile = "/var/db/ntpd.drift";
@@ -1868,11 +1868,6 @@ function system_ntp_configure($start_ntpd=true) {
return;
}
- /* At bootup we just want to write out the config. */
- if (!$start_ntpd) {
- return;
- }
-
/* if ntpd is running, kill it */
while (isvalidpid("{$g['varrun_path']}/ntpd.pid")) {
killbypid("{$g['varrun_path']}/ntpd.pid");
diff --git a/src/etc/pfSense.obsoletedfiles b/src/etc/pfSense.obsoletedfiles
index 655ea6f..16854e5 100644
--- a/src/etc/pfSense.obsoletedfiles
+++ b/src/etc/pfSense.obsoletedfiles
@@ -642,6 +642,7 @@
/usr/local/sbin/mdnsd
/usr/local/sbin/mini_httpd
/usr/local/sbin/mpd
+/usr/local/sbin/ntpdate_sync_once.sh
/usr/local/sbin/olsrd
/usr/local/sbin/pbi
/usr/local/sbin/pbi-crashhandler
diff --git a/src/etc/rc.bootup b/src/etc/rc.bootup
index 2a32a07..5c8b613 100755
--- a/src/etc/rc.bootup
+++ b/src/etc/rc.bootup
@@ -308,11 +308,9 @@ services_dnsmasq_configure();
/* start unbound service */
services_unbound_configure();
-/* Do an initial time sync */
+/* Enable ntpd */
echo "Starting NTP time client...";
-/* At bootup this will just write the config, ntpd will launch from ntpdate_sync_once.sh */
-system_ntp_configure(false);
-mwexec_bg("/usr/local/sbin/ntpdate_sync_once.sh", true);
+system_ntp_configure();
echo "done.\n";
/* start load balancer daemon */
diff --git a/src/usr/local/sbin/ntpdate_sync_once.sh b/src/usr/local/sbin/ntpdate_sync_once.sh
deleted file mode 100755
index 3372745..0000000
--- a/src/usr/local/sbin/ntpdate_sync_once.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh
-
-NOTSYNCED="true"
-MAX_ATTEMPTS=3
-SERVER=$(/usr/local/sbin/read_xml_tag.sh string system/timeservers)
-if [ -z "${SERVER}" ]; then
- exit
-fi
-
-/bin/pkill -f ntpdate_sync_once.sh
-
-ATTEMPT=1
-# Loop until we're synchronized, but for a set number of attempts so we don't get stuck here forever.
-while [ "$NOTSYNCED" = "true" ] && [ ${ATTEMPT} -le ${MAX_ATTEMPTS} ]; do
- # Ensure that ntpd and ntpdate are not running so that the socket we want will be free.
- while [ true ]; do
- /usr/bin/killall ntpdate 2>/dev/null
- /bin/pgrep ntpd
- if [ $? -eq 0 ]; then
- /usr/bin/killall ntpd 2>/dev/null
- else
- break
- fi
- done
- sleep 1
- /usr/local/sbin/ntpdate -s -t 5 ${SERVER}
- if [ "$?" = "0" ]; then
- NOTSYNCED="false"
- else
- sleep 5
- ATTEMPT=`expr ${ATTEMPT} + 1`
- fi
-done
-
-if [ "$NOTSYNCED" = "true" ]; then
- echo "Giving up on time sync after ${MAX_ATTEMPTS} attempts." | /usr/bin/logger -t ntp;
-else
- echo "Successfully synced time after ${ATTEMPT} attempts." | /usr/bin/logger -t ntp;
-fi
-
-if [ -f /var/etc/ntpd.conf ]; then
- echo "Starting NTP Daemon." | /usr/bin/logger -t ntp;
- /usr/local/sbin/ntpd -g -c /var/etc/ntpd.conf -p /var/run/ntpd.pid
-else
- echo "NTP configuration file missing, not starting daemon." | /usr/bin/logger -t ntp;
-fi
OpenPOWER on IntegriCloud