wok view phpvirtualbox/stuff/etc/init.d/vboxwebsrv @ rev 23406

updated perl-text-template (1.44 -> 1.58)
author Hans-G?nter Theisgen
date Wed Apr 01 06:37:49 2020 +0100 (2020-04-01)
parents 7f188676b59c
children
line source
1 #!/bin/sh
2 # Start, stop and restart vboxwebsrv daemon 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="$(_ '%s daemon' $NAME)"
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 _ '%s is already running.' $NAME
21 exit 1
22 fi
23 action 'Starting %s: %s...' "$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 _ '%s is not running.' $NAME
32 exit 1
33 fi
34 action 'Stopping %s: %s...' "$DESC" $NAME
35 kill $(cat $PIDFILE)
36 status
37 ;;
38 restart)
39 if ! active_pidfile $PIDFILE $NAME ; then
40 _ '%s is not running.' $NAME
41 exit 1
42 fi
43 action 'Restarting %s: %s...' "$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 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
53 newline
54 exit 1
55 ;;
56 esac
58 exit 0