]> git.ipfire.org Git - ipfire-2.x.git/blame - src/initscripts/system/ntp
unbound: check if red/iface exists before read it
[ipfire-2.x.git] / src / initscripts / system / ntp
CommitLineData
91dc1bfc
MT
1#!/bin/sh
2# Begin $rc_base/init.d/ntp
3
91dc1bfc
MT
4. /etc/sysconfig/rc
5. $rc_functions
6
ed0a0ba8
CS
7eval $(/usr/local/bin/readhash /var/ipfire/time/settings)
8
91dc1bfc
MT
9case "$1" in
10 start)
ed0a0ba8 11 if [ "$ENABLESETONBOOT" == "on" ]; then
0a79ec45 12 boot_mesg -n "Setting time on boot..."
829435be
AF
13 pidof wpa_supplicant dhcpcd 2>&1 > /dev/null
14 if [ "${?}" == "0" ]; then
b3aa7a12
AF
15 if [ ! -e /var/ipfire/red/active ]; then
16 boot_mesg ""
96e31c98 17 boot_mesg -n "Waiting for red connection"
b3aa7a12
AF
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
0a79ec45
AF
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
b3aa7a12 32 boot_mesg " ERROR! Not online!"
0a79ec45
AF
33 echo_warning
34 fi
35 fi
ed0a0ba8 36
91dc1bfc 37 boot_mesg "Starting ntpd..."
6f300951 38 loadproc /usr/bin/ntpd -Ap /var/run/ntpd.pid
91dc1bfc
MT
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 ;;
60esac
61
62# End $rc_base/init.d/ntp