#!/bin/sh
#
# mmtcpfwd	This shell script takes care of starting and stopping mmtcpfwd.
#
# chkconfig:	345 83 27
# description:	Secure TCP/IP port forwarder
#
# processname:	mmtcpfwd
# config:	/etc/mmtcpfwd.conf
#

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

RETVAL=0
case "$1" in
  start)
	# Check if the service is already running?
	if [ ! -f /var/lock/subsys/mmtcpfwd ]; then
		msg_starting mmtcpfwd
		daemon mmtcpfwd
		RETVAL=$?
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/mmtcpfwd
	else
		msg_already_running mmtcpfwd
	fi
	;;
  stop)
	# Stop daemons.
	if [ -f /var/lock/subsys/mmtcpfwd ]; then
		msg_stopping mmtcpfwd
		killproc mmtcpfwd
		rm -f /var/lock/subsys/mmtcpfwd >/dev/null 2>&1
	else
		msg_not_running mmtcpfwd
	fi
	;;
  restart|force-reload)
	$0 stop
	$0 start
	exit $?
	;;
  status)
	status mmtcpfwd
	exit $?
	;;
  *)
	msg_usage "$0 {start|stop|restart|force-reload|status}"
	exit 3
esac

exit $RETVAL
