root/usr/local/sbin/ntpdate_sync_once.sh @ 8a880cb9
1 |
#!/bin/sh
|
---|---|
2 |
|
3 |
NOTSYNCED="true" |
4 |
SERVER=`cat /cf/conf/config.xml | grep timeservers | cut -d">" -f2 | cut -d"<" -f1` |
5 |
pkill -f ntpdate_sync_once.sh
|
6 |
|
7 |
while [ "$NOTSYNCED" = "true" ]; do |
8 |
# Ensure that ntpd and ntpdate are not running so that the socket we want will be free.
|
9 |
killall ntpd 2>/dev/null |
10 |
killall ntpdate |
11 |
sleep 1
|
12 |
ntpdate -s -t 5 $SERVER |
13 |
if [ "$?" = "0" ]; then |
14 |
NOTSYNCED="false" |
15 |
fi
|
16 |
sleep 5 |
17 |
done
|
18 |
|
19 |
/usr/local/sbin/ntpd -s -f /var/etc/ntpd.conf |