wok annotate ntp/stuff/ntp @ rev 16521
libgd: try an other fix!
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Apr 26 00:27:15 2014 +0200 (2014-04-26) |
parents | a0b8d051ad35 |
children | 7f188676b59c |
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@14734 | 28 pgrep $DAEMON > $PIDFILE # it seems that -p doesn't work ? |
pascal@1751 | 29 ;; |
pascal@1751 | 30 stop) |
pascal@2400 | 31 if ! active_pidfile $PIDFILE ntpd ; then |
pascal@1751 | 32 echo "$NAME is not running." |
pascal@1751 | 33 exit 1 |
pascal@1751 | 34 fi |
pascal@1751 | 35 echo -n "Stopping $DESC: $NAME... " |
pascal@1751 | 36 kill `cat $PIDFILE` |
pascal@1751 | 37 rm $PIDFILE |
pascal@1751 | 38 status |
pascal@1751 | 39 ;; |
pascal@1751 | 40 restart) |
pascal@2400 | 41 if ! active_pidfile $PIDFILE ntpd ; then |
pascal@1751 | 42 echo "$NAME is not running." |
pascal@1751 | 43 exit 1 |
pascal@1751 | 44 fi |
pascal@1751 | 45 echo -n "Restarting $DESC: $NAME... " |
pascal@1751 | 46 kill `cat $PIDFILE` |
pascal@1751 | 47 $DAEMON $OPTIONS |
pascal@1751 | 48 status |
pascal@14734 | 49 pgrep $DAEMON > $PIDFILE # it seems that -p doesn't work ? |
pascal@1751 | 50 ;; |
pascal@1751 | 51 *) |
pascal@1751 | 52 echo "" |
pascal@1751 | 53 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pascal@1751 | 54 echo "" |
pascal@1751 | 55 exit 1 |
pascal@1751 | 56 ;; |
pascal@1751 | 57 esac |
pascal@1751 | 58 |
pascal@1751 | 59 exit 0 |