]>
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 AF |
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 | |
ed0a0ba8 | 33 | |
91dc1bfc | 34 | boot_mesg "Starting ntpd..." |
6f300951 | 35 | loadproc /usr/bin/ntpd -Ap /var/run/ntpd.pid |
91dc1bfc MT |
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 |