#!/bin/sh
### BEGIN INIT INFO
# Provides: webmin
# Required-Start: $network $syslog
# Required-Stop: $network
# Default-Start: 2 3 5
# Description: Start/stop Webmin
### END INIT INFO
case "$1" in
'start')
/etc/webmin/start >/dev/null 2>&1 </dev/null
RETVAL=$?
;;
'stop')
/etc/webmin/stop
RETVAL=$?
;;
'status')
pidfile=`grep "^pidfile=" /etc/webmin/miniserv.conf | sed -e 's/pidfile=//g'`
if [ -s $pidfile ]; then
pid=`cat $pidfile`
kill -0 $pid >/dev/null 2>&1
if [ "$?" = "0" ]; then
echo "webmin (pid $pid) is running"
RETVAL=0
else
echo "webmin is stopped"
RETVAL=1
fi
else
echo "webmin is stopped"
RETVAL=1
fi
;;
'restart')
/etc/webmin/stop ; /etc/webmin/start
RETVAL=$?
;;
*)
echo "Usage: $0 { start | stop }"
RETVAL=1
;;
esac
exit $RETVAL