Sophie

Sophie

distrib > Mandriva > 2006.0 > x86_64 > by-pkgid > 5d7da98a796c0898bd957659a5d9906a > files > 4

drakxtools-http-10.3-0.64.3.20060mdk.x86_64.rpm

#!/bin/sh
# chkconfig: 235 99 00
# description: Start or stop the miniserv administration server

# 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 %s: " "$name" perl $server /etc/$name/conf
	touch $subsys
	echo $name
}

stop ()
{
	action "Shutting down %s: " "$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
			gprintf "%s (pid %s) is running\n" "$name" "$pid"
		else
			gprintf "%s is stopped\n" "$name"
		fi
	else
		gprintf "%s is stopped\n" "$name"
	fi
	;;
'restart')
	restart;;
'reload')
        restart;;
'condrestart')
	[[ -f $subsys ]] && restart;;
*)
	gprintf "Usage: %s {start|stop|restart|status|reload|condrestart}\n" "$0"
	;;
esac
exit 0