Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates-src > by-pkgid > 61537fb87f9994db809cbef942a6512b > files > 24

webmin-1.930-1.mga7.src.rpm

#!/bin/sh
#
# webmin        Start Webmin remote administration tool. This script
#               starts the Webmin server.
#
# chkconfig: 2345 90 20
#
# description: Webmin is a remote administration tool using web-browser
# processname: perl
# pidfile: /var/run/webmin/miniserv.pid
# config: /etc/webmin/miniserv.conf
# config: /etc/webmin/miniserv.users

### BEGIN INIT INFO
# Provides: webmin
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Short-Description: Webmin is a remote administration tool using web-browser
# Description: Start Webmin remote administration tool. This script
#              starts the Webmin server.
### END INIT INFO

. /etc/rc.d/init.d/functions

RETVAL=0

if [ ! -d /usr/share/webmin ] || [ ! -d /etc/webmin ] || [ ! -f /etc/webmin/start ] || [ ! -f /etc/webmin/stop ]; then
    echo "Webmin installation failed, I can't go further."
    RETVAL="-1"
fi
 
case "$1" in
  start)
	gprintf "Starting Webmin"
       	/etc/webmin/start
	RETVAL=$?
	[[ $RETVAL -eq 0 ]] && touch /var/lock/subsys/webmin
	;;
  stop)
	gprintf "Stopping Webmin"
        /etc/webmin/stop
	RETVAL=$?
	[[ $RETVAL -eq 0 ]] && rm -f /var/lock/subsys/webmin
	;;
  status)
	if ! [ -f /var/run/webmin/miniserv.pid ] ; then 
		gprintf "miniserv.pl is stopped"
		RETVAL=3
	else
		pid=`cat /var/run/webmin/miniserv.pid`
		kill -0 $pid >/dev/null 2>&1
		RETVAL=$?
		if [ $RETVAL == 0 ] ; then
		       gprintf "miniserv.pl (pid %s) is running..." $pid
		else
			gprintf "miniserv.pl is stopped"
		RETVAL=3
		fi
	fi
	;;
  restart)
  	$0 stop
	$0 start
	;;
  reload)
  	$0 stop
	$0 start
	;;
  condrestart)
       if [ -f /var/lock/subsys/webmin ]; then
	    $0 stop
	    $0 start
	fi
	;;
*)
	gprintf "Usage: %s {start|stop|status|restart|condrestart }" $0
	RETVAL=1
	;;
esac
echo
exit $RETVAL