#! /bin/sh
#
# skeleton      Example file to build /etc/init.d scripts.
#
# Version:      @(#) /etc/init.d/mcserv  07/10/2000
#
# Author:       Tomasz Kłoczko, <kloczek@rudy.mif.pg.gda.pl>
#               Michele Marziani <marziani@fe.infn.it>
#		Preston Brown <pbrown@redhat.com>
#
# chkconfig: - 86 30
# description: The Midnight Commander server allows users on remote machines \
#	       to use the Midnight Commander file manager to manipulate their \
#	       files on the machine running the server. The server  \
#              authenticates the user through PAM, which by default requires \
#              a username/password combination before allowing access.
# processname: mcserv

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

RETVAL=0

prog="mcserv"

start() {
        echo -n $"Starting $prog: "
       daemon /usr/bin/mcserv -d
       RETVAL=$?
       touch /var/lock/subsys/mcserv
       echo
}

stop() {
        echo -n $"Stopping $prog: "
       killproc mcserv
       RETVAL=$?
       rm -f /var/lock/subsys/mcserv
       echo
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  status)
        status mcserv
	;;
  restart|reload)
        stop
	start
        ;;
  condrestart)
	if [ -f /var/lock/subsys/mcserv ]; then
    	    stop
	    start
	fi
	;;
  stop)
	stop
	;;
  *)
	echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}"
	exit 1
esac

exit $RETVAL
