summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-04-08 11:46:30 -0400
committerjim-p <jimp@pfsense.org>2011-04-08 11:46:30 -0400
commitedf99ce40cf56c804e02b54a22f11e212b556c6a (patch)
treeef3677dfdb3ee648d00e2eb8ce4f86e33a77901f /usr
parent54c185948cf9950c8bef29c9817633f3b9bdbef4 (diff)
downloadpfsense-edf99ce40cf56c804e02b54a22f11e212b556c6a.zip
pfsense-edf99ce40cf56c804e02b54a22f11e212b556c6a.tar.gz
Rework ntpdate_sync_once.sh, so it makes sure ntp/ntpdate/itself are not running before trying to sync time, and then launch ntpd at the end for time sync (last commit was premature)
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/sbin/ntpdate_sync_once.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr/local/sbin/ntpdate_sync_once.sh b/usr/local/sbin/ntpdate_sync_once.sh
index d2dc37b..e328ac4 100755
--- a/usr/local/sbin/ntpdate_sync_once.sh
+++ b/usr/local/sbin/ntpdate_sync_once.sh
@@ -2,11 +2,18 @@
NOTSYNCED="true"
SERVER=`cat /cf/conf/config.xml | grep timeservers | cut -d">" -f2 | cut -d"<" -f1`
+pkill -f ntpdate_sync_once.sh
while [ "$NOTSYNCED" = "true" ]; do
- ntpdate -s $SERVER
+ # Ensure that ntpd and ntpdate are not running so that the socket we want will be free.
+ killall ntpd 2>/dev/null
+ killall ntpdate
+ sleep 1
+ ntpdate -s -t 5 $SERVER
if [ "$?" = "0" ]; then
NOTSYNCED="false"
fi
sleep 5
done
+
+/usr/local/sbin/ntpd -s -f /var/etc/ntpd.conf \ No newline at end of file
OpenPOWER on IntegriCloud