#!/bin/sh
#
# mcserv	The Midnight Commander file server
#
# chkconfig:	345 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/rc.d/init.d/functions

# Get network config
. /etc/sysconfig/network

# Get service config
[ -f /etc/sysconfig/mscerv ] && . /etc/sysconfig/mscerv

# Check that networking is up.
if [ "${NETWORKING}" = "no" ]; then
	echo "WARNING: Networking is down. Mcserv service can't be runed."
	exit 1
fi


# See how we were called.
case "$1" in
  start)
	# Check if the service is already running?
	if [ ! -f /var/lock/subsys/mcserv ]; then
		show Starting mcserv
		daemon mcserv $OPTIONS
	else
		echo "mcserv already is running"
	fi
	touch /var/lock/subsys/mcserv
	;;
  status)
        status mcserv
	;;
  restart|reload)
        $0 stop
	$0 start
        ;;
  stop)
        show Shutting down mcserv
	killproc mcserv
	rm -f /var/lock/subsys/mcserv
	;;
  *)
	echo "Usage: $0 {start|stop|status|restart|reload}"
	exit 1
esac

exit 0

