]>
Commit | Line | Data |
---|---|---|
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 |
7 | eval $(/usr/local/bin/readhash /var/ipfire/time/settings) |
8 | ||
91dc1bfc MT |
9 | case "$1" in |
10 | start) | |
ed0a0ba8 | 11 | if [ "$ENABLESETONBOOT" == "on" ]; then |
0a79ec45 | 12 | boot_mesg -n "Setting time on boot..." |
b3aa7a12 AF |
13 | if [ $(pidof wpa_supplicant) ]; then |
14 | if [ ! -e /var/ipfire/red/active ]; then | |
15 | boot_mesg "" | |
16 | boot_mesg -n "Wait for wlan" | |
17 | for (( i=30; i>1; i-- )) do | |
18 | if [ -e /var/ipfire/red/active ]; then | |
19 | break; | |
20 | fi | |
21 | boot_mesg -n "." | |
22 | sleep 2 | |
23 | done | |
24 | sleep 5 | |
25 | fi | |
0a79ec45 AF |
26 | fi |
27 | if [ -e /var/ipfire/red/active ]; then | |
28 | boot_mesg "" | |
29 | loadproc /usr/local/bin/settime $(cat /var/ipfire/time/settime.conf) | |
30 | else | |
b3aa7a12 | 31 | boot_mesg " ERROR! Not online!" |
0a79ec45 AF |
32 | echo_warning |
33 | fi | |
34 | fi | |
ed0a0ba8 | 35 | |
91dc1bfc | 36 | boot_mesg "Starting ntpd..." |
6f300951 | 37 | loadproc /usr/bin/ntpd -Ap /var/run/ntpd.pid |
91dc1bfc MT |
38 | ;; |
39 | ||
40 | stop) | |
41 | boot_mesg "Stopping ntpd..." | |
42 | killproc /usr/bin/ntpd | |
43 | ;; | |
44 | ||
45 | restart) | |
46 | $0 stop | |
47 | sleep 1 | |
48 | $0 start | |
49 | ;; | |
50 | ||
51 | status) | |
52 | statusproc /usr/bin/ntpd | |
53 | ;; | |
54 | ||
55 | *) | |
56 | echo "Usage: $0 {start|stop|restart|status}" | |
57 | exit 1 | |
58 | ;; | |
59 | esac | |
60 | ||
61 | # End $rc_base/init.d/ntp |