#!/bin/sh
#
# chkconfig: 345 56 50
# description: xinetd is a powerful replacement for inetd. \
#              xinetd has access control machanisms, extensive logging \
#              capabilities, the ability to make services available based \
#              on time, and can place limits on the number of servers \
#              that can be started, among other things. 
# probe: true
# processname: nuftpd
# pidfile: /var/run/nuftpd.pid

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

# Check that tmp dir exist.
[ -d /var/tmp/nftpu ] || exit 0

RETVAL=0

start(){
    echo -n "Starting nuftpd user creating daemon"
    daemon nuftpd -pidfile /var/run/nuftpd.pid &
    RETVAL=$?
    echo
    touch /var/lock/subsys/nuftpd 
    return 0
}

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

}

restart(){
    stop
    start
}


# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
 restart)
	restart
	;;
  *)
	echo "Usage: xinetd {start|stop|restart}"
	RETVAL=1
esac

exit $RETVAL

