--- webmin-1.350/webmin-init.init~ 2007-06-01 01:20:52.000000000 +0000 +++ webmin-1.350/webmin-init 2007-07-20 09:27:56.000000000 +0000 @@ -1,71 +1,79 @@ #!/bin/sh -# chkconfig: 235 99 10 -# description: Start or stop the Webmin server -# -### BEGIN INIT INFO -# Provides: webmin -# Required-Start: $network $syslog -# Required-Stop: $network -# Default-Start: 2 3 5 -# Default-Stop: 0 1 6 -# Description: Start or stop the Webmin server -### END INIT INFO - -start=/etc/webmin/start -stop=/etc/webmin/stop -lockfile=/var/lock/subsys/webmin -confFile=/etc/webmin/miniserv.conf -pidFile=/var/webmin/miniserv.pid -name='Webmin' +# chkconfig: - 99 10 +# description: Start or stop the Webmin web administration tool +# processname: miniserv.pl -case "$1" in -'start') - $start >/dev/null 2>&1 </dev/null +# Source function library. +. /etc/init.d/functions + +prog="webmin" + +start() { + echo -n $"Starting $prog: " + daemon /etc/webmin/start RETVAL=$? - if [ "$RETVAL" = "0" ]; then - touch $lockfile >/dev/null 2>&1 - fi - ;; -'stop') - $stop + echo + [ $RETVAL -eq 0 ] & touch /var/lock/subsys/webmin + return $RETVAL +} + +stop() { + echo -n $"Stopping $prog: " + /etc/webmin/stop &>/dev/null RETVAL=$? - if [ "$RETVAL" = "0" ]; then - rm -f $lockfile - fi - pidfile=`grep "^pidfile=" $confFile | sed -e 's/pidfile=//g'` - if [ "$pidfile" = "" ]; then - pidfile=$pidFile + if [ $RETVAL -eq 0 ]; then + rm -f /var/lock/subsys/webmin + success + else + failure $"webmin shutdown" fi - rm -f $pidfile - ;; -'status') - pidfile=`grep "^pidfile=" $confFile | sed -e 's/pidfile=//g'` + return $RETVAL +} + +restart() { + start + stop +} + +showstatus() { + pidfile=`grep "^pidfile=" /etc/webmin/miniserv.conf | sed -e 's/pidfile=//g'` if [ "$pidfile" = "" ]; then - pidfile=$pidFile + pidfile="/var/webmin/miniserv.pid" fi if [ -s $pidfile ]; then pid=`cat $pidfile` kill -0 $pid >/dev/null 2>&1 if [ "$?" = "0" ]; then - echo "$name (pid $pid) is running" + echo $"$prog (pid $pid) is running" RETVAL=0 else - echo "$name is stopped" + echo $"$prog is stopped" RETVAL=1 fi else - echo "$name is stopped" + echo $"$prog is stopped" RETVAL=1 fi +} + +case "$1" in +start) + start ;; -'restart') - $stop ; $start - RETVAL=$? +stop) + stop + ;; +status) + showstatus + ;; +restart) + restart + ;; +condrestart) + [ -f /var/lock/subsys/webmin ] && restart || : ;; *) - echo "Usage: $0 { start | stop | restart }" - RETVAL=1 + echo "Usage: $0 {start|stop|status|restart|condrestart}" ;; esac -exit $RETVAL - +exit $?