wok view ntp/stuff/ntp @ rev 11391
Compat: replace exit by return in slitaz-toolchain recipe.
author | Antoine Bodin <gokhlayeh@slitaz.org> |
---|---|
date | Sat Dec 10 05:10:43 2011 +0100 (2011-12-10) |
parents | 58eb08d32c24 |
children | e1f16de14d6e |
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 ;;
29 stop)
30 if ! active_pidfile $PIDFILE ntpd ; then
31 echo "$NAME is not running."
32 exit 1
33 fi
34 echo -n "Stopping $DESC: $NAME... "
35 kill `cat $PIDFILE`
36 rm $PIDFILE
37 status
38 ;;
39 restart)
40 if ! active_pidfile $PIDFILE ntpd ; then
41 echo "$NAME is not running."
42 exit 1
43 fi
44 echo -n "Restarting $DESC: $NAME... "
45 kill `cat $PIDFILE`
46 $DAEMON $OPTIONS
47 status
48 ;;
49 *)
50 echo ""
51 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
52 echo ""
53 exit 1
54 ;;
55 esac
57 exit 0