wok-6.x annotate phpvirtualbox/stuff/etc/init.d/vboxwebsrv @ rev 7738
Add phpvirtualbox
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Dec 20 14:58:13 2010 +0100 (2010-12-20) |
parents | |
children | 7f188676b59c |
rev | line source |
---|---|
pascal@7738 | 1 #!/bin/sh |
pascal@7738 | 2 # Start, stop and restart vboxwebsrv deamon on SliTaz, at boot time or |
pascal@7738 | 3 # with the command line. |
pascal@7738 | 4 # |
pascal@7738 | 5 # To start daemon at boot time, just put vboxwebsrv in the $RUN_DAEMONS |
pascal@7738 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf. |
pascal@7738 | 7 # |
pascal@7738 | 8 . /etc/init.d/rc.functions |
pascal@7738 | 9 |
pascal@7738 | 10 NAME=$(basename $0) |
pascal@7738 | 11 DESC="$NAME deamon" |
pascal@7738 | 12 DAEMON=$(which $NAME) |
pascal@7738 | 13 OPTIONS="-b --logfile /dev/null" |
pascal@7738 | 14 eval $(grep -i ^${NAME}_OPTIONS /etc/daemons.conf | sed 's/.*_OPT/OPT/') |
pascal@7738 | 15 PIDFILE=/var/run/$NAME.pid |
pascal@7738 | 16 |
pascal@7738 | 17 case "$1" in |
pascal@7738 | 18 start) |
pascal@7738 | 19 if active_pidfile $PIDFILE $NAME ; then |
pascal@7738 | 20 echo "$NAME is already running." |
pascal@7738 | 21 exit 1 |
pascal@7738 | 22 fi |
pascal@7738 | 23 echo -n "Starting $DESC: $NAME... " |
pascal@7738 | 24 $DAEMON $OPTIONS > /dev/null 2>&1 |
pascal@7738 | 25 [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE |
pascal@7738 | 26 active_pidfile $PIDFILE $NAME |
pascal@7738 | 27 status |
pascal@7738 | 28 ;; |
pascal@7738 | 29 stop) |
pascal@7738 | 30 if ! active_pidfile $PIDFILE $NAME ; then |
pascal@7738 | 31 echo "$NAME is not running." |
pascal@7738 | 32 exit 1 |
pascal@7738 | 33 fi |
pascal@7738 | 34 echo -n "Stopping $DESC: $NAME... " |
pascal@7738 | 35 kill `cat $PIDFILE` |
pascal@7738 | 36 status |
pascal@7738 | 37 ;; |
pascal@7738 | 38 restart) |
pascal@7738 | 39 if ! active_pidfile $PIDFILE $NAME ; then |
pascal@7738 | 40 echo "$NAME is not running." |
pascal@7738 | 41 exit 1 |
pascal@7738 | 42 fi |
pascal@7738 | 43 echo -n "Restarting $DESC: $NAME... " |
pascal@7738 | 44 kill `cat $PIDFILE` |
pascal@7738 | 45 sleep 2 |
pascal@7738 | 46 $DAEMON $OPTIONS > /dev/null 2>&1 |
pascal@7738 | 47 [ -f $PIDFILE ] || pidof $NAME | awk '{ print $1 }' > $PIDFILE |
pascal@7738 | 48 active_pidfile $PIDFILE $NAME |
pascal@7738 | 49 status |
pascal@7738 | 50 ;; |
pascal@7738 | 51 *) |
pascal@7738 | 52 echo "" |
pascal@7738 | 53 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pascal@7738 | 54 echo "" |
pascal@7738 | 55 exit 1 |
pascal@7738 | 56 ;; |
pascal@7738 | 57 esac |
pascal@7738 | 58 |
pascal@7738 | 59 exit 0 |