pfsense/usr/local/sbin/ntpdate_sync_once.sh
Scott Ullrich 88e46869c7 * Use defined server from config.xml
* Sleep for 5 seconds in between requests
2008-11-12 19:42:43 +00:00

18 lines
334 B
Bash
Executable File

#!/bin/sh
NOTSYNCED="true"
SERVER=`cat /cf/conf/config.xml | grep timeservers | cut -d">" -f2 | cut -d"<" -f1`
while [ "$NOTSYNCED" = "true" ]; do
ntpdate $SERVER
if [ "$?" = "0" ]; then
NOTSYNCED="false"
fi
sleep 5
done
# Launch -- we have net.
killall ntpd 2>/dev/null
sleep 1
/usr/local/sbin/ntpd -s -f /var/etc/ntpd.conf