wok-next view ntp/stuff/ntp @ rev 18279

Up mate-panel: update deps
author Yuri Pourre <yuripourre@gmail.com>
date Sun Aug 09 17:20:41 2015 -0300 (2015-08-09)
parents a0b8d051ad35
children 7f188676b59c
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="ntp server"
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"
19 case "$1" in
20 start)
21 if active_pidfile $PIDFILE ntpd ; then
22 echo "$NAME already running."
23 exit 1
24 fi
25 echo -n "Starting $DESC: $NAME... "
26 $DAEMON $OPTIONS
27 status
28 pgrep $DAEMON > $PIDFILE # it seems that -p doesn't work ?
29 ;;
30 stop)
31 if ! active_pidfile $PIDFILE ntpd ; then
32 echo "$NAME is not running."
33 exit 1
34 fi
35 echo -n "Stopping $DESC: $NAME... "
36 kill `cat $PIDFILE`
37 rm $PIDFILE
38 status
39 ;;
40 restart)
41 if ! active_pidfile $PIDFILE ntpd ; then
42 echo "$NAME is not running."
43 exit 1
44 fi
45 echo -n "Restarting $DESC: $NAME... "
46 kill `cat $PIDFILE`
47 $DAEMON $OPTIONS
48 status
49 pgrep $DAEMON > $PIDFILE # it seems that -p doesn't work ?
50 ;;
51 *)
52 echo ""
53 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
54 echo ""
55 exit 1
56 ;;
57 esac
59 exit 0