wok-next annotate ntp/stuff/ntp @ rev 9316
Up openvas-manager (1.0.4)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Mar 18 09:19:41 2011 +0100 (2011-03-18) |
parents | 58eb08d32c24 |
children | e1f16de14d6e |
rev | line source |
---|---|
pascal@1751 | 1 #!/bin/sh |
pascal@1751 | 2 # /etc/init.d/ntp : Start, stop and restart ntp server on SliTaz, at |
pascal@1751 | 3 # boot time or with the command line. |
pascal@1751 | 4 # |
pascal@1751 | 5 # To start ntp server at boot time, just put ntp in the $RUN_DAEMONS |
pascal@1751 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf |
pascal@1751 | 7 # |
pascal@1751 | 8 . /etc/init.d/rc.functions |
pascal@1751 | 9 . /etc/daemons.conf |
pascal@1751 | 10 |
pascal@1751 | 11 NAME=ntp |
pascal@1751 | 12 DESC="ntp server" |
pascal@1751 | 13 DAEMON=/usr/bin/ntpd |
pascal@1751 | 14 OPTIONS=$NTP_OPTIONS |
pascal@1751 | 15 PIDFILE=/var/run/ntpd.pid |
pascal@1751 | 16 [ -n "$OPTIONS" ] || OPTIONS="-p $PIDFILE -c /etc/ntp.conf" |
pascal@1751 | 17 |
pascal@1751 | 18 |
pascal@1751 | 19 case "$1" in |
pascal@1751 | 20 start) |
pascal@2400 | 21 if active_pidfile $PIDFILE ntpd ; then |
pascal@1751 | 22 echo "$NAME already running." |
pascal@1751 | 23 exit 1 |
pascal@1751 | 24 fi |
pascal@1751 | 25 echo -n "Starting $DESC: $NAME... " |
pascal@1751 | 26 $DAEMON $OPTIONS |
pascal@1751 | 27 status |
pascal@1751 | 28 ;; |
pascal@1751 | 29 stop) |
pascal@2400 | 30 if ! active_pidfile $PIDFILE ntpd ; then |
pascal@1751 | 31 echo "$NAME is not running." |
pascal@1751 | 32 exit 1 |
pascal@1751 | 33 fi |
pascal@1751 | 34 echo -n "Stopping $DESC: $NAME... " |
pascal@1751 | 35 kill `cat $PIDFILE` |
pascal@1751 | 36 rm $PIDFILE |
pascal@1751 | 37 status |
pascal@1751 | 38 ;; |
pascal@1751 | 39 restart) |
pascal@2400 | 40 if ! active_pidfile $PIDFILE ntpd ; then |
pascal@1751 | 41 echo "$NAME is not running." |
pascal@1751 | 42 exit 1 |
pascal@1751 | 43 fi |
pascal@1751 | 44 echo -n "Restarting $DESC: $NAME... " |
pascal@1751 | 45 kill `cat $PIDFILE` |
pascal@1751 | 46 $DAEMON $OPTIONS |
pascal@1751 | 47 status |
pascal@1751 | 48 ;; |
pascal@1751 | 49 *) |
pascal@1751 | 50 echo "" |
pascal@1751 | 51 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pascal@1751 | 52 echo "" |
pascal@1751 | 53 exit 1 |
pascal@1751 | 54 ;; |
pascal@1751 | 55 esac |
pascal@1751 | 56 |
pascal@1751 | 57 exit 0 |