]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/system/ntp
unbound/ntp: move not working DNS fallback from ntp to unbound initskript
[people/pmueller/ipfire-2.x.git] / src / initscripts / system / ntp
1 #!/bin/sh
2 # Begin $rc_base/init.d/ntp
3
4 . /etc/sysconfig/rc
5 . $rc_functions
6
7 eval $(/usr/local/bin/readhash /var/ipfire/time/settings)
8
9 case "$1" in
10 start)
11 if [ "$ENABLESETONBOOT" == "on" ]; then
12 boot_mesg -n "Setting time on boot..."
13 pidof wpa_supplicant dhcpcd 2>&1 > /dev/null
14 if [ "${?}" == "0" ]; then
15 if [ ! -e /var/ipfire/red/active ]; then
16 boot_mesg ""
17 boot_mesg -n "Waiting for red connection"
18 for (( i=30; i>1; i-- )) do
19 if [ -e /var/ipfire/red/active ]; then
20 break;
21 fi
22 boot_mesg -n "."
23 sleep 2
24 done
25 sleep 5
26 fi
27 fi
28 if [ -e /var/ipfire/red/active ]; then
29 boot_mesg ""
30 loadproc /usr/local/bin/settime $(cat /var/ipfire/time/settime.conf)
31 else
32 boot_mesg " ERROR! Not online!"
33 echo_warning
34 fi
35 fi
36
37 boot_mesg "Starting ntpd..."
38 loadproc /usr/bin/ntpd -Ap /var/run/ntpd.pid
39 ;;
40
41 stop)
42 boot_mesg "Stopping ntpd..."
43 killproc /usr/bin/ntpd
44 ;;
45
46 restart)
47 $0 stop
48 sleep 1
49 $0 start
50 ;;
51
52 status)
53 statusproc /usr/bin/ntpd
54 ;;
55
56 *)
57 echo "Usage: $0 {start|stop|restart|status}"
58 exit 1
59 ;;
60 esac
61
62 # End $rc_base/init.d/ntp