Advertisement
kevin25

ProFTP startup script

Dec 11th, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.17 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3.   # ProFTPD files
  4.   FTPD_BIN=/usr/local/sbin/proftpd
  5.   FTPD_CONF=/usr/local/etc/proftpd.conf
  6.   PIDFILE=/var/run/proftpd.pid
  7.  
  8.   # If PIDFILE exists, does it point to a proftpd process?
  9.  
  10.   if [ -f $PIDFILE ]; then
  11.    pid=`cat $PIDFILE`
  12.   fi
  13.  
  14.   if [ ! -x $FTPD_BIN ]; then
  15.     echo "$0: $FTPD_BIN: cannot execute"
  16.     exit 1
  17.   fi
  18.  
  19.   case $1 in
  20.  
  21.     start)
  22.       if [ -n "$pid" ]; then
  23.         echo "$0: proftpd [PID $pid] already running"
  24.         exit
  25.       fi
  26.  
  27.       if [ -r $FTPD_CONF ]; then
  28.         echo "Starting proftpd..."
  29.  
  30.         $FTPD_BIN -c $FTPD_CONF
  31.  
  32.       else
  33.         echo "$0: cannot start proftpd -- $FTPD_CONF missing"
  34.       fi
  35.       ;;
  36.  
  37.     stop)
  38.       if [ -n "$pid" ]; then
  39.         echo "Stopping proftpd..."
  40.         kill -TERM $pid
  41.  
  42.       else
  43.         echo "$0: proftpd not running"
  44.         exit 1
  45.       fi
  46.       ;;
  47.  
  48.     restart)
  49.       if [ -n "$pid" ]; then
  50.         echo "Rehashing proftpd configuration"
  51.         kill -HUP $pid
  52.  
  53.       else
  54.         echo "$0: proftpd not running"
  55.         exit 1
  56.       fi
  57.       ;;
  58.  
  59.     *)
  60.       echo "usage: $0 {start|stop|restart}"
  61.       exit 1
  62.       ;;
  63.  
  64.   esac
  65.  
  66.   exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement