Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

pure-ftpd

By: a guest on Jan 13th, 2012  |  syntax: Bash  |  size: 3.09 KB  |  hits: 84  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          pure-ftpd
  4. # Required-Start:    $remote_fs $syslog
  5. # Required-Stop:     $remote_fs $syslog
  6. # Should-Start:      slapd mysql postgresql-8.3 postgresql-8.4
  7. # Should-Stop:       slapd mysql postgresql-8.3 postgresql-8.4
  8. # Default-Start:     2 3 4 5
  9. # Default-Stop:      0 1 6
  10. ### END INIT INFO
  11. #
  12. # pure-ftpd     starts and stops the pure-ftpd ftp daemon
  13. #
  14. # Copyright 2002-2011 by Stefan Hornburg (Racke) <racke@linuxia.de>
  15.  
  16. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  17. NAME=pure-ftpd
  18. DESC="ftp server"
  19. : ${SSDAEMONLOGOPTS:="--quiet"}
  20. UPLOADDAEMON=/usr/sbin/pure-uploadscript
  21. UDNAME=pure-uploadscript
  22. UDDESC="ftp upload handler"
  23. WRAPPER=/usr/sbin/pure-ftpd-wrapper
  24.  
  25. # load LSB init-functions to get status_of_proc helper
  26. . /lib/lsb/init-functions
  27.  
  28. PIDFILE=/var/run/pure-ftpd/pure-ftpd.pid
  29.  
  30. # try to figure with suffix this script is called,
  31. # $0 might be a symlink pointing to this script
  32. if [ -h $0 ]; then
  33.         ME=`/bin/readlink $0`
  34. else
  35.         ME=$0
  36. fi
  37.  
  38. SUFFIX=`basename $ME | sed -ne 's/^pure-ftpd-\(.*\)/\1/p'`
  39. if [ "$SUFFIX" ] ; then
  40.         DAEMON=/usr/sbin/pure-ftpd-$SUFFIX
  41. else
  42.         DAEMON=/usr/sbin/pure-ftpd
  43. fi
  44.  
  45. export STANDALONE_OR_INETD=inetd
  46. export VIRTUALCHROOT=
  47. test -r /etc/default/pure-ftpd-common && . /etc/default/pure-ftpd-common
  48.  
  49. if [ "$VIRTUALCHROOT" = "true" ]; then
  50.         if [ "$SUFFIX" ]; then
  51.                 SUFFIX="$SUFFIX-virtualchroot"
  52.         else
  53.                 SUFFIX="virtualchroot"
  54.         fi
  55. fi
  56.  
  57. test -x $DAEMON || exit 0
  58. test -x $WRAPPER || exit 0
  59.  
  60. set -e
  61.  
  62. if [ ! -e `dirname $PIDFILE` ];then
  63.        mkdir `dirname $PIDFILE`
  64. fi
  65.  
  66. start_uploadscript() {
  67.         if [ "$UPLOADSCRIPT" -a "$STANDALONE_OR_INETD" != inetd ] && \
  68.                 egrep -i '^[    ]*(yes|1|on)[   ]*' /etc/pure-ftpd/conf/CallUploadScript > /dev/null 2>&1
  69.         then
  70.                 UOPTS=""
  71.                 test "$UPLOADUID" && UOPTS="$UOPTS -u $UPLOADUID"
  72.                 test "$UPLOADGID" && UOPTS="$UOPTS -g $UPLOADGID"
  73.                 echo -n "$1 $UDDESC: "
  74.                 start-stop-daemon --start $SSDAEMONLOGOPTS --oknodo \
  75.                         --exec $UPLOADDAEMON -- -r "$UPLOADSCRIPT" -B $UOPTS
  76.                 echo "$UDNAME."
  77.                
  78.         fi
  79. }
  80.  
  81. case "$1" in
  82.   start)
  83.         test "$STANDALONE_OR_INETD" = standalone || exit 0
  84.         echo -n "Starting $DESC: "
  85.         start-stop-daemon --start $SSDAEMONLOGOPTS --pidfile "$PIDFILE" \
  86.                 --exec $WRAPPER -- $SUFFIX
  87.         start_uploadscript Starting
  88.         ;;
  89.   stop)
  90.         echo -n "Stopping $DESC: "
  91.         start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo \
  92.                 --pidfile "$PIDFILE"
  93.         start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo --exec $UPLOADDAEMON
  94.         echo "$NAME."
  95.         ;;
  96.   restart|force-reload)
  97.         test "$STANDALONE_OR_INETD" = standalone || exit 0
  98.         echo -n "Restarting $DESC: "
  99.         start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo \
  100.                 --pidfile "$PIDFILE"
  101.         start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo --exec $UPLOADDAEMON
  102.         sleep 1
  103.         start-stop-daemon --start $SSDAEMONLOGOPTS --pidfile "$PIDFILE" \
  104.                 --exec $WRAPPER -- $SUFFIX
  105.         start_uploadscript Restarting
  106.         ;;
  107.   status)
  108.         status_of_proc -p /var/run/pure-ftpd/pure-ftpd.pid $DAEMON $NAME && exit 0 || exit $?
  109.         ;;
  110.   *)
  111.         N=/etc/init.d/$NAME
  112.         echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
  113.         exit 1
  114.         ;;
  115. esac
  116.  
  117. exit 0