]>
Commit | Line | Data |
---|---|---|
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 [ $(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 | |
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 | |
31 | boot_mesg " ERROR! Not online!" | |
32 | echo_warning | |
33 | fi | |
34 | fi | |
35 | ||
36 | boot_mesg "Starting ntpd..." | |
37 | loadproc /usr/bin/ntpd -Ap /var/run/ntpd.pid | |
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 |