#!/bin/bash
#
# description: Starts and stops the webmin services

NAME=webmin

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# See how we were called.
case "$1" in
 start)
  [ -e $SVIlock ] && exit 1
  [ ${NETWORKING} = "no" ] && exit 2

  #SVIbool true "$CONFIGURED" || 
  SVIemptyConfig /etc/webmin/config && {
    echo "$DESCRIPTIVE: not configured! Skipped..."
    exit 2
  }

  echo -n "Starting $IDENT: "
  /etc/webmin/start
  touch $SVIlock
  ;;

 stop)
  [ -e $SVIlock ] || exit 0

  echo -n "Stopping $IDENT: "
  /etc/webmin/stop
  rm -f $SVIlock
  ;;

 restart)
  echo "Restarting $IDENT: "
  $0 stop
  $0 start
  exit $?
  ;;

 *)
  echo "Usage: $SVIscript {start|restart|stop}"
  exit 1
  ;;
esac

exit 0
