it's the original script.
i haven't modified it.

Francesco Paolo Lovergine wrote:
On Fri, May 05, 2006 at 03:08:26PM +0200, H??morszky Bal??zs wrote:
not fixed

Preparing to replace proftpd 1.3.0-4 (using .../proftpd_1.3.0-5_i386.deb) ...
Stopping ftp server: proftpd failed!
invoke-rc.d: initscript proftpd, action "stop" failed.
dpkg: warning - old pre-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
Stopping ftp server: proftpd failed!
invoke-rc.d: initscript proftpd, action "stop" failed.
dpkg: error processing /var/cache/apt/archives/proftpd_1.3.0-5_i386.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/proftpd_1.3.0-5_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)


Would you please followup with your current /etc/init.d/proftpd script?

#!/bin/sh 

# Start the proftpd FTP daemon.

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/proftpd
NAME=proftpd

# Defaults
RUN="no"
OPTIONS=""

PIDFILE=`grep -i 'pidfile' /etc/proftpd/proftpd.conf | sed -e 's/pidfile[\t 
]\+//i'`
if [ "x$PIDFILE" = "x" ];
then
        PIDFILE=/var/run/proftpd.pid
fi

# Read config (will override defaults)
[ -r /etc/default/proftpd ] && . /etc/default/proftpd

trap "" 1
trap "" 15

test -f $DAEMON || exit 0

#
# These compatibility funcs are here just for sarge backports.
# They will be removed post-etch.
#
log_daemon_msg() {
    echo -n "$1: $2"
}

log_end_msg() {
    if [ $1 -ne 0 ]; then
       echo " failed!"
    else
       echo "."
    fi
}

[ -f /lib/lsb/init-functions ] && source /lib/lsb/init-functions

#
# Servertype could be inetd|standalone|none.
# In all cases check against inetd and xinetd support.
#
if ! egrep -qi "^[[:space:]]*ServerType.*standalone" /etc/proftpd/proftpd.conf
then
    if [ $(dpkg-divert --list xinetd|wc -l) -eq 1 ] 
    then
        if egrep -qi "server[[:space:]]*=[[:space:]]*/usr/sbin/proftpd" 
/etc/xinetd.conf 2>/dev/null || \
           egrep -qi "server[[:space:]]*=[[:space:]]*/usr/sbin/proftpd" 
/etc/xinetd.d/* 2>/dev/null
        then
                RUN="no"
                INETD="yes"
        else
                if ! egrep -qi "^[[:space:]]*ServerType.*inetd" 
/etc/proftpd/proftpd.conf
                then
                        RUN="yes"
                        INETD="no"
                else
                        RUN="no"
                        INETD="no"
                fi
        fi
    else
        if egrep -qi "^ftp.*/usr/sbin/proftpd" /etc/inetd.conf 2>/dev/null
        then
                RUN="no"
                INETD="yes"
        else
                if ! egrep -qi "^[[:space:]]*ServerType.*inetd" 
/etc/proftpd/proftpd.conf
                then
                        RUN="yes"
                        INETD="no"
                else
                        RUN="no"
                        INETD="no"
                fi
        fi
    fi
fi

start()
{
    log_daemon_msg "Starting ftp server" "$NAME"

    start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec $DAEMON -- 
$OPTIONS  
    if [ $? != 0 ]; then
        log_end_msg 1
        exit 1
    else
        log_end_msg 0
    fi
}

signal()
{

    if [ "$1" = "stop" ]; then
        SIGNAL="TERM"
        log_daemon_msg "Stopping ftp server" "$NAME"
    else
        if [ "$1" = "reload" ]; then
            SIGNAL="HUP"
            log_daemon_msg "Reloading ftp server" "$NAME"
        else
            echo "ERR: wrong parameter given to signal()"
            exit 1
        fi
    fi
    start-stop-daemon --stop --signal $SIGNAL --quiet --pidfile "$PIDFILE"
    if [ $? = 0 ]; then
        log_end_msg 0
    else
        SIGNAL="KILL"
        start-stop-daemon --stop --signal $SIGNAL --quiet --pidfile "$PIDFILE"
        if [ $? != 0 ]; then
                log_end_msg 1
                [ $2 != 0 ] || exit 1
        else
                log_end_msg 0
        fi
    fi
    if [ "$SIGNAL" = "KILL" ]; then
            rm -f "$PIDFILE"
    fi
}

case "$1" in
    start)
        if [ "x$RUN" = "xyes" ] ; then
            start
        else
            if [ "x$INETD" = "xyes" ] ; then
                echo "ProFTPd is started from inetd/xinetd."
            else 
                echo "ProFTPd warning: cannot start neither in standalone nor 
in inetd/xinetd mode. Check your configuration."
            fi
        fi
        ;;

    force-start)
        if [ "x$INETD" = "xyes" ] ; then
            echo "Warning: ProFTPd is started from inetd/xinetd (trying to 
start anyway)."
        fi
        start
        ;;      
    
    stop)
        if [ "x$RUN" = "xyes" ] ; then
            signal stop 0
        else
            if [ "x$INETD" = "xyes" ] ; then
                echo "ProFTPd is started from inetd/xinetd."
            else 
                echo "ProFTPd warning: cannot start neither in standalone nor 
in inetd/xinetd mode. Check your configuration."
            fi
        fi
        ;;

    force-stop)
        if [ "x$INETD" = "xyes" ] ; then
            echo "Warning: ProFTPd is started from inetd/xinetd (trying to kill 
anyway)."
        fi
        signal stop 0
        ;;

    reload)
        signal reload 0
        ;;

    force-reload|restart)
        if [ "x$RUN" = "xyes" ] ; then
            signal stop 1
            sleep 2
            start
        else
            if [ "x$INETD" = "xyes" ] ; then
                echo "ProFTPd is started from inetd."
            else 
                echo "ProFTPd warning: cannot start neither in standalone nor 
in inetd/xinetd mode. Check your configuration."
            fi
        fi
        ;;

    *)
        echo "Usage: /etc/init.d/$NAME 
{start|force-start|stop|force-stop|reload|restart|force-reload}"
        exit 1
        ;;
esac

exit 0

Reply via email to