]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/initscripts/init.d/ntp
Merge remote-tracking branch 'alfh/feature_htmlclean_removefont' into next
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / 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 if [ ! -e /var/ipfire/red/active ]; then
14 boot_mesg ""
15 boot_mesg -n "Wait for online connection"
16 for (( i=30; i>1; i-- )) do
17 if [ -e /var/ipfire/red/active ]; then
18 break;
19 fi
20 boot_mesg -n "."
21 sleep 1
22 done
23 sleep 5
24 fi
25 if [ -e /var/ipfire/red/active ]; then
26 boot_mesg ""
27 loadproc /usr/local/bin/settime $(cat /var/ipfire/time/settime.conf)
28 else
29 boot_mesg " not online!"
30 echo_warning
31 fi
32 fi
33
34 boot_mesg "Starting ntpd..."
35 loadproc /usr/bin/ntpd -Ap /var/run/ntpd.pid
36 ;;
37
38 stop)
39 boot_mesg "Stopping ntpd..."
40 killproc /usr/bin/ntpd
41 ;;
42
43 restart)
44 $0 stop
45 sleep 1
46 $0 start
47 ;;
48
49 status)
50 statusproc /usr/bin/ntpd
51 ;;
52
53 *)
54 echo "Usage: $0 {start|stop|restart|status}"
55 exit 1
56 ;;
57 esac
58
59 # End $rc_base/init.d/ntp