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

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