wok-4.x view phpvirtualbox/stuff/etc/init.d/vboxwebsrv @ rev 10589

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