pure-ftpd init script fails to start server in standalone mode
+ Etch / Testing.
+ pure-ftpd 1.0.21-3
This is a fresh debian install and a fresh instll of pure-ftpd. There has been no configuration. I did an apt-get install pure-ftpd and then manually edited /etc/init.d/pure-ftpd only to change STANDALONE_OR_INETD=inetd to standalone. There have been no other alterations to anything.
Starting pure-ftpd directly works:
/usr/sbin/pure-ftpd
Issuing stop to the init script displays Stopping ftp server: pure-ftpd.
/etc/init.d/pure-ftpd stop
Issuing start to the init script does nothing.
/etc/init.d/pure-ftpd start
I have the following at the top of the init script:
export STANDALONE_OR_INETD=standalone
I echo $STANDALONE_OR_INETD near the top of the script just after it is set. So, when I run the script no matter what, it confirms that it is set to standalone on the command line.
However, the following test for start case in the script fails, so the daemon is never started:
[HTML]case "$1" in
start)
test "$STANDALONE_OR_INETD" = standalone || exit 0
echo -n "Starting $DESC: "
start-stop-daemon --start $SSDAEMONLOGOPTS --pidfile /var/run/pure-ftpd/pure-ftpd.pid \
--exec $WRAPPER -- $SUFFIX
start_uploadscript Starting
;;
[/HTML]
If I remove the test line, it echos Starting to the command line, indicating that the test for $STANDALONE_OR_INETD is the problem. (Note that the stop does not have a test case, which is why it successfully executes).
Here is the full init script:
[HTML]
#! /bin/sh
#
# pure-ftpd starts and stops the pure-ftpd ftp daemon
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=pure-ftpd
DESC="ftp server"
: ${SSDAEMONLOGOPTS:="--quiet"}
UPLOADDAEMON=/usr/sbin/pure-uploadscript
UDNAME=pure-uploadscript
UDDESC="ftp upload handler"
WRAPPER=/usr/sbin/pure-ftpd-wrapper
# try to figure with suffix this script is called,
# $0 might be a symlink pointing to this script
if [ -h $0 ]; then
ME=`/bin/readlink $0`
else
ME=$0
fi
SUFFIX=`basename $ME | sed -ne 's/^pure-ftpd-\(.*\)/\1/p'`
if [ "$SUFFIX" ] ; then
DAEMON=/usr/sbin/pure-ftpd-$SUFFIX
else
DAEMON=/usr/sbin/pure-ftpd
fi
export STANDALONE_OR_INETD=standalone
export VIRTUALCHROOT=
test -r /etc/default/pure-ftpd-common && . /etc/default/pure-ftpd-common
if [ "$VIRTUALCHROOT" = "true" ]; then
if [ "$SUFFIX" ]; then
SUFFIX="$SUFFIX-virtualchroot"
else
SUFFIX="virtualchroot"
fi
fi
test -x $DAEMON || exit 0
test -x $WRAPPER || exit 0
set -e
start_uploadscript() {
if [ "$UPLOADSCRIPT" -a "$STANDALONE_OR_INETD" != inetd ] && \
egrep -i '^[ ]*(yes|1|on)[ ]*' /etc/pure-ftpd/conf/CallUploadScript > /dev/null 2>&1
then
UOPTS=""
test "$UPLOADUID" && UOPTS="$UOPTS -u $UPLOADUID"
test "$UPLOADGID" && UOPTS="$UOPTS -g $UPLOADGID"
echo -n "$1 $UDDESC: "
start-stop-daemon --start $SSDAEMONLOGOPTS --oknodo \
--exec $UPLOADDAEMON -- -r "$UPLOADSCRIPT" -B $UOPTS
echo "$UDNAME."
fi
}
case "$1" in
start)
test "$STANDALONE_OR_INETD" = standalone || exit 0
echo -n "Starting $DESC: "
start-stop-daemon --start $SSDAEMONLOGOPTS --pidfile /var/run/pure-ftpd/pure-ftpd.pid \
--exec $WRAPPER -- $SUFFIX
start_uploadscript Starting
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo \
--pidfile /var/run/pure-ftpd/pure-ftpd.pid
start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo --exec $UPLOADDAEMON
echo "$NAME."
;;
restart|force-reload)
test "$STANDALONE_OR_INETD" = standalone || exit 0
echo -n "Restarting $DESC: "
start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo \
--pidfile /var/run/pure-ftpd/pure-ftpd.pid
start-stop-daemon --stop $SSDAEMONLOGOPTS --oknodo --exec $UPLOADDAEMON
sleep 1
start-stop-daemon --start $SSDAEMONLOGOPTS --pidfile \
/var/run/pure-ftpd/pure-ftpd.pid --exec $WRAPPER -- $SUFFIX
start_uploadscript Restarting
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
[/HTML]
Anyone with similar experience? Any suggestions? Is there some obvious flaw in the init script that I am not catching? If so, I'll file a bug - but I thought I'd see if this is a unique instance or not first. Like I mentioned, this is very default. I haven't configured pure-ftpd in any way and the only modification is to change 'inetd' to 'standalone' as necessary.
Any assistance would be greatly appreciated.
Regards.
Last edited by Cronjob; 05-22-2006 at 12:36 PM.
|