Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

Untitled
Sunday, April 22nd, 2007 at 6:09:09pm UTC 

  1. #! /bin/sh
  2. #
  3. # pure-ftpd     starts and stops the pure-ftpd ftp daemon
  4.  
  5. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  6. NAME=pure-ftpd
  7. DESC="ftp server"
  8. : ${SSDAEMONLOGOPTS:="--quiet"}
  9. UPLOADDAEMON=/usr/sbin/pure-uploadscript
  10. UDNAME=pure-uploadscript
  11. UDDESC="ftp upload handler"
  12. WRAPPER=/usr/sbin/pure-ftpd-wrapper
  13.  
  14. # try to figure with suffix this script is called,
  15. # $0 might be a symlink pointing to this script
  16. if [ -h $0 ]; then
  17.         ME=`/bin/readlink $0`
  18. else
  19.         ME=$0
  20. fi
  21.  
  22. SUFFIX=`basename $ME | sed -ne 's/^pure-ftpd-\(.*\)/\1/p'`
  23. if [ "$SUFFIX" ] ; then
  24.         DAEMON=/usr/sbin/pure-ftpd-$SUFFIX
  25. else
  26.         DAEMON=/usr/sbin/pure-ftpd
  27. fi
  28.  
  29. export STANDALONE_OR_INETD=inetd
  30. export VIRTUALCHROOT=
  31. test -r /etc/default/pure-ftpd-common && . /etc/default/pure-ftpd-common
  32.  
  33. if [ "$VIRTUALCHROOT" = "true" ]; then
  34.         if [ "$SUFFIX" ]; then
  35.                 SUFFIX="$SUFFIX-virtualchroot"
  36.         else
  37.                 SUFFIX="virtualchroot"
  38.         fi
  39. fi
  40.  
  41. test -x $DAEMON || exit 0
  42. test -x $WRAPPER || exit 0
  43.  
  44. set -e
  45.  
  46. start_uploadscript() {
  47.         if [ "$UPLOADSCRIPT" -a "$STANDALONE_OR_INETD" != inetd ] && \
  48.                 egrep -i '^[    ]*(yes|1|on)[   ]*' /etc/pure-ftpd/conf/CallUploadScript > /dev/null 2>&1
  49.         then
  50.                 UOPTS=""
  51.                 test "$UPLOADUID" && UOPTS="$UOPTS -u $UPLOADUID"
  52.                 test "$UPLOADGID" && UOPTS="$UOPTS -g $UPLOADGID"
  53.                 echo -n "$1 $UDDESC: "
  54.                 start-stop-daemon --start $SSDAEMONLOGOPTS --oknodo \
  55.                         --exec $UPLOADDAEMON -- -r "$UPLOADSCRIPT" -B $UOPTS
  56.                 echo "$UDNAME."
  57.  
  58.         fi
  59. }
  60.  
  61. case "$1" in
  62.   start)
  63.         test "$STANDALONE_OR_INETD" = standalone || exit 0
  64.         echo -n "Starting $DESC: "
  65.         start-stop-daemon --start $SSDAEMONLOGOPTS --pidfile /var/run/pure-ftpd/pure-ftpd.pid \
  66.                 --exec $WRAPPER -- $SUFFIX
  67.         start_uploadscript Starting
  68.         ;;
  69.   stop)
  70.         echo -n "Stopping $DESC: "
  71.         start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo \
  72.                 --pidfile /var/run/pure-ftpd/pure-ftpd.pid
  73.         start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo --exec $UPLOADDAEMON
  74.         echo "$NAME."
  75.         ;;
  76.   restart|force-reload)
  77.         test "$STANDALONE_OR_INETD" = standalone || exit 0
  78.         echo -n "Restarting $DESC: "
  79.         start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo \
  80.                 --pidfile /var/run/pure-ftpd/pure-ftpd.pid
  81.         start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo --exec $UPLOADDAEMON
  82.         sleep 1
  83.         start-stop-daemon --start $SSDAEMONLOGOPTS --pidfile \
  84.                 /var/run/pure-ftpd/pure-ftpd.pid --exec $WRAPPER -- $SUFFIX
  85.         start_uploadscript Restarting
  86.         ;;
  87.   *)
  88.         N=/etc/init.d/$NAME
  89.         echo "Usage: $N {start|stop|restart|force-reload}" >&2
  90.         exit 1
  91.         ;;
  92. esac
  93.  
  94. exit 0

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right worth-right