#!/bin/sh
#
# /etc/rc.d/rc.bftpd
#
# Start/stop/restart the Bftpd server.
#

ftpd_start() {
  if [ -x /usr/sbin/bftpd ]; then
    echo -n "Starting Bftpd..."
    /usr/sbin/bftpd -d 
    echo "OK!"
  else
    echo "ERROR! Bftpd does not appear to be installed!"
  fi
}

ftpd_stop() {
  echo -n "Stopping Bftpd..."
  killall bftpd 2>/dev/null && echo "OK!" || echo "Failed!"
}

ftpd_restart() {
  ftpd_stop
  sleep 2
  ftpd_start
}

case "$1" in
'start')
  ftpd_start
  ;;
'stop')
  ftpd_stop
  ;;
'restart')
  ftpd_restart
  ;;
*)
  echo "rc.bftpd: starts and stops the Bftpd server"
  echo "usage: $0 start|stop|restart"
esac

# EOF

