summaryrefslogtreecommitdiff
path: root/recipes/ntp/files/ntpdate
blob: b9963b772abac909b9f7b9b799d49ccdd0fb06b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh

PATH=/sbin:/bin:/usr/bin

test -f /usr/bin/ntpdate || exit 0

if test -f /etc/default/ntpdate ; then
. /etc/default/ntpdate
else
NTPSERVERS="pool.ntp.org"
fi

test -n "$NTPSERVERS" || exit 0

case "$1" in
start|force-reload)
  echo -n "Running ntpdate to synchronize clock"
  /usr/bin/ntpdate -u -b -s $NTPOPTIONS $NTPSERVERS
  echo "."
  ;;
restart|reload)
  # Drop -b to slew clock rather than step it if called after system is up
  echo -n "Running ntpdate to synchronize clock"
  /usr/bin/ntpdate -u -s $NTPOPTIONS $NTPSERVERS
  echo "."
  ;;
stop)
  ;;
*)
  echo "Usage: /etc/init.d/ntpdate {start|stop|restart|reload|force-reload}"
  exit 1
esac

exit 0