wok-next annotate boxbackup-server/stuff/bbstored @ rev 2340
boxbackup-server: improve start script
author | Dominique Corbex <domcox@users.sourceforge.net> |
---|---|
date | Mon Mar 02 19:38:39 2009 +0100 (2009-03-02) |
parents | 14003687d2b8 |
children | e99b372b0465 |
rev | line source |
---|---|
domcox@1357 | 1 #!/bin/sh |
domcox@1357 | 2 # /etc/init.d/bbstored: Start, stop and restart bbstored deamon on SliTaz, at boot |
domcox@1357 | 3 # time or with the command line. |
domcox@1357 | 4 # |
domcox@1357 | 5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS |
domcox@1357 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf. |
domcox@1357 | 7 # |
domcox@1357 | 8 . /etc/init.d/rc.functions |
domcox@1357 | 9 . /etc/daemons.conf |
domcox@1357 | 10 |
domcox@1357 | 11 NAME=BBstored |
domcox@1357 | 12 DESC="BoxBackup server deamon" |
domcox@1357 | 13 DAEMON=/usr/bin/bbstored |
domcox@1357 | 14 OPTIONS=$BBSTORED_OPTIONS |
domcox@1357 | 15 PIDFILE=/var/run/bbstored.pid |
domcox@1357 | 16 |
domcox@1357 | 17 case "$1" in |
domcox@1357 | 18 start) |
domcox@1357 | 19 if [ -f $PIDFILE ] ; then |
domcox@1357 | 20 echo "$NAME already running." |
domcox@1357 | 21 exit 1 |
domcox@1357 | 22 fi |
domcox@1357 | 23 echo -n "Starting $DESC: $NAME... " |
domcox@1357 | 24 $DAEMON $OPTIONS > /dev/null |
domcox@1357 | 25 status |
domcox@1357 | 26 ;; |
domcox@1357 | 27 stop) |
domcox@1357 | 28 if [ ! -f $PIDFILE ] ; then |
domcox@1357 | 29 echo "$NAME is not running." |
domcox@1357 | 30 exit 1 |
domcox@1357 | 31 fi |
domcox@1357 | 32 echo -n "Stopping $DESC: $NAME... " |
domcox@1357 | 33 kill `cat $PIDFILE` |
domcox@2340 | 34 rm -f $PIDFILE |
domcox@1357 | 35 status |
domcox@1357 | 36 ;; |
domcox@1357 | 37 restart) |
domcox@1357 | 38 if [ ! -f $PIDFILE ] ; then |
domcox@1357 | 39 echo "$NAME is not running." |
domcox@1357 | 40 exit 1 |
domcox@1357 | 41 fi |
domcox@1357 | 42 echo -n "Restarting $DESC: $NAME... " |
domcox@1357 | 43 kill `cat $PIDFILE` |
domcox@2340 | 44 rm -f $PIDFILE |
domcox@1357 | 45 sleep 2 |
domcox@1357 | 46 $DAEMON $OPTIONS > /dev/null |
domcox@1357 | 47 status |
domcox@1357 | 48 ;; |
domcox@1357 | 49 *) |
domcox@1357 | 50 echo "" |
domcox@1357 | 51 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
domcox@1357 | 52 echo "" |
domcox@1357 | 53 exit 1 |
domcox@1357 | 54 ;; |
domcox@1357 | 55 esac |
domcox@1357 | 56 |
domcox@1357 | 57 exit 0 |