#!/bin/sh
#
# Starts the Dftpd server
#

# Set this path to the dftpd root
cd /dftpd/bin

# Checks if the server is already running
if [ -r "dftpd.pid" ] ; then
  DFTPD_PID=`cat "dftpd.pid"`
  kill -s HUP $DFTPD_PID > /dev/null 2>&1
  if [ $? = 0 ] ; then
    echo "Dftpd is already running (PID $DFTPD_PID)."
    exit 1
  fi
  rm -f dftpd.pid
fi

# Start the server
./dftpd > /dev/null 2>&1 &
echo $! > dftpd.pid
echo "Dftpd started."

