]> git.pld-linux.org Git - packages/pure-ftpd.git/blobdiff - pure-ftpd.init
If -E is specified (no anonymous logins) then treat "ftp" and "anonymous" logins...
[packages/pure-ftpd.git] / pure-ftpd.init
index 49650acdaca40e576dcb119361714ede62794d8f..b5f6ca7255a8ccd00108a0a8d1d3d0634ddbc108 100644 (file)
 # Check for available parsers
 if [ -x /usr/sbin/pure-config ] ; then
        CFG=/usr/sbin/pure-config
-elif [ -x /usr/sbin/pure-config.pl -a -x /usr/bin/perl ] ; then 
+elif [ -x /usr/sbin/pure-config.pl -a -x /usr/bin/perl ] ; then
        CFG=/usr/sbin/pure-config.pl
 elif [ -x /usr/sbin/pure-config.py -a -x /usr/bin/python ] ; then
        CFG=/usr/sbin/pure-config.py
 else
        echo 'Error: pure-config{,.pl,.py} not found. Giving up.'
        exit 1
-fi     
+fi
 
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
        if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
-               # nls "ERROR: Networking is down. %s can't be run." <service>
                msg_network_down pure-ftpd
                exit 1
        fi
@@ -38,15 +37,13 @@ else
        exit 0
 fi
 
-RETVAL=0
-# See how we were called.
-case "$1" in
-  start)
+start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/pure-ftpd ]; then
                msg_starting pure-ftpd
                rm -f /var/run/pure-ftpd/client*
                if [ x"$CFG" = "x/usr/sbin/pure-config" ] ; then
+                       modprobe -s capability > /dev/null 2>&1
                        daemon /usr/sbin/pure-ftpd \
                                $(/usr/sbin/pure-config -f /etc/ftpd/pureftpd.conf) \
                                --daemonize
@@ -55,32 +52,59 @@ case "$1" in
                        daemon $CFG /etc/ftpd/pureftpd.conf --daemonize
                        RETVAL=$?
                fi
+               
+               if [ -n "$UPLOADSCRIPT" ]; then
+                       msg_starting pure-uploadscript
+                       UPLOADSCRIPTOPTS="-B -r $UPLOADSCRIPT"
+                       [ -n "$UPLOADSCRIPT_UID" ] && UPLOADSCRIPTOPTS="$UPLOADSCRIPTOPTS -u $UPLOADSCRIPT_UID"
+                       [ -n "$UPLOADSCRIPT_GID" ] && UPLOADSCRIPTOPTS="$UPLOADSCRIPTOPTS -g $UPLOADSCRIPT_GID"
+                       daemon /usr/sbin/pure-uploadscript $UPLOADSCRIPTOPTS
+                       RETVAL=$(($RETVAL+$?))
+               fi
+
                [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pure-ftpd
        else
                msg_already_running pure-ftpd
        fi
-       ;;
-  stop)
+}
+
+stop() {
        # Stop daemons.
        if [ -f /var/lock/subsys/pure-ftpd ]; then
+               if [ -n "$UPLOADSCRIPT" ]; then
+                   msg_stopping pure-uploadscript
+                   killproc pure-uploadscript
+               fi
+
                msg_stopping pure-ftpd
                killproc pure-ftpd
+               
                rm -f /var/lock/subsys/pure-ftpd > /dev/null 2>&1
        else
                msg_not_running pure-ftpd
        fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+       start
+       ;;
+  stop)
+       stop
        ;;
   status)
        status pure-ftpd
+       status pure-uploadscript
        RETVAL=$?
        if [ $RETVAL -eq 0 ]; then
                pure-ftpwho
        fi
        ;;
   restart|force-reload)
-       $0 stop
-       $0 start
-       exit $?
+       stop
+       start
        ;;
   *)
        msg_usage "$0 {start|stop|restart|force-reload|status}"
This page took 0.078717 seconds and 4 git commands to generate.