#!/bin/sh
#
# jftpgw	FTP proxy/gateway
#
# chkconfig:	345 85 15
# description:	FTP proxy/gateway
#
# processname:	jftpgw
# pidfile:	/var/run/jftpgw.pid
# config:	/etc/run/jftpgw/jftpgw.conf


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

# Get network config
. /etc/sysconfig/network

# Check that networking is up.
if is_no "${NETWORKING}"; then
       msg_network_down jftpgw
       exit 1
fi


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

exit $RETVAL
