summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/interactive_http/miniserv.init
blob: 266f74089df8cbf0eb1167a6251fda4ac4f1711c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
# chkconfig: 235 99 00
# description: Start or stop the miniserv administration server
### BEGIN INIT INFO
# Provides: drakxtools_http
# Should-Start: $network
# Default-Start: 3 4 5
# Short-Description: Web administration server for Mandriva utilities
# Description: Start or stop the miniserv administration server for Mandriva utilities
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

subsys=/var/lock/subsys/drakxtools_http
name=drakxtools_http
server=/usr/share/libDrakX/$name/miniserv.pl

start ()
{
	action "Starting $name: " perl $server /etc/$name/conf
	touch $subsys
	echo $name
}

stop ()
{
	action "Shutting down $name: " kill `cat /var/run/$name.pid`
	rm -f $subsys
	echo $name
}

restart ()
{
	stop
	start
}

case "$1" in
'start')
	start;;
'stop')
	stop;;
'status')
	if [ -s /var/run/$name.pid ]; then
	    pid=`cat /var/run/$name.pid`
		kill -0 $pid >/dev/null 2>&1
		if [ "$?" = "0" ]; then
			echo "$name (pid $pid) is running"
		else
			echo "$name is stopped"
		fi
	else
		echo "$name is stopped"
	fi
	;;
'restart')
	restart;;
'reload')
        restart;;
'condrestart')
	[[ -f $subsys ]] && restart;;
*)
	echo "Usage: $0 {start|stop|restart|status|reload|condrestart}"
	;;
esac
exit 0