wok-6.x annotate chillispot/stuff/chilli @ rev 1325
Add chillispot
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Aug 29 10:16:41 2008 +0000 (2008-08-29) |
parents | |
children | 1b6281d68d9f |
rev | line source |
---|---|
pascal@1325 | 1 #!/bin/sh |
pascal@1325 | 2 # /etc/init.d/chilli : Start, stop and restart ChilliSpot server on SliTaz, at |
pascal@1325 | 3 # boot time or with the command line. |
pascal@1325 | 4 # |
pascal@1325 | 5 # To start ChilliSpot server at boot time, just put chilli in the $RUN_DAEMONS |
pascal@1325 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf |
pascal@1325 | 7 # |
pascal@1325 | 8 . /etc/init.d/rc.functions |
pascal@1325 | 9 . /etc/daemons.conf |
pascal@1325 | 10 |
pascal@1325 | 11 NAME=ChilliSpot |
pascal@1325 | 12 DESC="ChilliSpot server" |
pascal@1325 | 13 DAEMON=/usr/sbin/chilli |
pascal@1325 | 14 OPTIONS=$CHILLI_OPTIONS |
pascal@1325 | 15 PIDFILE=/var/run/chilli.pid |
pascal@1325 | 16 [ -n "$OPTIONS" ] || OPTIONS="--pidfile $PIDFILE --statedir /var/lib/chilli/" |
pascal@1325 | 17 |
pascal@1325 | 18 case "$1" in |
pascal@1325 | 19 start) |
pascal@1325 | 20 if [ -f $PIDFILE ] ; then |
pascal@1325 | 21 echo "$NAME already running." |
pascal@1325 | 22 exit 1 |
pascal@1325 | 23 fi |
pascal@1325 | 24 $DAEMON $OPTIONS |
pascal@1325 | 25 status |
pascal@1325 | 26 ;; |
pascal@1325 | 27 stop) |
pascal@1325 | 28 if [ ! -f $PIDFILE ] ; then |
pascal@1325 | 29 echo "$NAME is not running." |
pascal@1325 | 30 exit 1 |
pascal@1325 | 31 fi |
pascal@1325 | 32 echo -n "Stopping $DESC: $NAME... " |
pascal@1325 | 33 kill `cat $PIDFILE` |
pascal@1325 | 34 status |
pascal@1325 | 35 ;; |
pascal@1325 | 36 restart) |
pascal@1325 | 37 if [ ! -f $PIDFILE ] ; then |
pascal@1325 | 38 echo "$NAME is not running." |
pascal@1325 | 39 exit 1 |
pascal@1325 | 40 fi |
pascal@1325 | 41 echo -n "Restarting $DESC: $NAME... " |
pascal@1325 | 42 kill `cat $PIDFILE` |
pascal@1325 | 43 sleep 2 |
pascal@1325 | 44 $DAEMON $OPTIONS |
pascal@1325 | 45 status |
pascal@1325 | 46 ;; |
pascal@1325 | 47 *) |
pascal@1325 | 48 echo "" |
pascal@1325 | 49 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pascal@1325 | 50 echo "" |
pascal@1325 | 51 exit 1 |
pascal@1325 | 52 ;; |
pascal@1325 | 53 esac |
pascal@1325 | 54 |
pascal@1325 | 55 exit 0 |