wok-6.x view ntp/stuff/ntp @ rev 20151

Up gnu-efi (3.0.6) again
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Dec 07 11:52:24 2017 +0100 (2017-12-07)
parents e1f16de14d6e
children
line source
1 #!/bin/sh
2 # /etc/init.d/ntp : Start, stop and restart ntp server on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start ntp server at boot time, just put ntp in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=ntp
12 DESC="$(_ '%s server' NTP)"
13 DAEMON=/usr/bin/ntpd
14 OPTIONS=$NTP_OPTIONS
15 PIDFILE=/var/run/ntpd.pid
16 [ -n "$OPTIONS" ] || OPTIONS="-p $PIDFILE -c /etc/ntp.conf"
18 case "$1" in
19 start)
20 if active_pidfile $PIDFILE ntpd ; then
21 _ '%s is already running.' $NAME
22 exit 1
23 fi
24 action 'Starting %s: %s...' "$DESC" $NAME
25 $DAEMON $OPTIONS
26 status
27 pgrep $DAEMON > $PIDFILE # it seems that -p doesn't work ?
28 ;;
29 stop)
30 if ! active_pidfile $PIDFILE ntpd ; then
31 _ '%s is not running.' $NAME
32 exit 1
33 fi
34 action 'Stopping %s: %s...' "$DESC" $NAME
35 kill $(cat $PIDFILE)
36 rm $PIDFILE
37 status
38 ;;
39 restart)
40 if ! active_pidfile $PIDFILE ntpd ; then
41 _ '%s is not running.' $NAME
42 exit 1
43 fi
44 action 'Restarting %s: %s...' "$DESC" $NAME
45 kill $(cat $PIDFILE)
46 $DAEMON $OPTIONS
47 status
48 pgrep $DAEMON > $PIDFILE # it seems that -p doesn't work ?
49 ;;
50 *)
51 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
52 newline
53 exit 1
54 ;;
55 esac
57 exit 0