LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 05-22-2006, 12:35 PM   #1
Cronjob
LQ Newbie
 
Registered: May 2004
Posts: 20

Rep: Reputation: 0
Question 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.
 
Old 05-23-2006, 12:11 AM   #2
Cronjob
LQ Newbie
 
Registered: May 2004
Posts: 20

Original Poster
Rep: Reputation: 0
Okay, this is weird.

I know that the START case block is processed, but inside that block, it sees $STANDALONE_OR_INETD as "inetd" even though earlier in the script it is set explicitely to "standalone". :/

If I add "STANDALONE_OR_INETD=standalone" just above the "test" line, it works and starts the server. I'm not much for bash shell scripting, but can anyone enlighten me as to why the value set outside isn't seen inside even though it appears to be set globally?

A bash -x /etc/init.d/pure-ftpd start also shows that this is happening - that it does a test for inetd=standalone and then exits...

[HTML]
+ PATH=/sbin:/bin:/usr/sbin:/usr/bin
+ NAME=pure-ftpd
+ DESC='ftp server'
+ : --quiet
+ UPLOADDAEMON=/usr/sbin/pure-uploadscript
+ UDNAME=pure-uploadscript
+ UDDESC='ftp upload handler'
+ WRAPPER=/usr/sbin/pure-ftpd-wrapper
+ '[' -h /etc/init.d/pure-ftpd ']'
+ ME=/etc/init.d/pure-ftpd
++ basename /etc/init.d/pure-ftpd
++ sed -ne 's/^pure-ftpd-\(.*\)/\1/p'
+ SUFFIX=
+ '[' '' ']'
+ DAEMON=/usr/sbin/pure-ftpd
+ export STANDALONE_OR_INETD=standalone
+ STANDALONE_OR_INETD=standalone
+ export VIRTUALCHROOT=
+ VIRTUALCHROOT=
+ test -r /etc/default/pure-ftpd-common
+ . /etc/default/pure-ftpd-common
++ STANDALONE_OR_INETD=inetd
++ VIRTUALCHROOT=false
++ UPLOADSCRIPT=
++ UPLOADUID=
++ UPLOADGID=
+ '[' false = true ']'
+ test -x /usr/sbin/pure-ftpd
+ test -x /usr/sbin/pure-ftpd-wrapper
+ set -e
+ case "$1" in
+ test inetd = standalone
+ exit 0
[/HTML]
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Forward to another ftp-server with pure-ftpd didi86 Linux - Software 0 12-20-2004 12:55 PM
Set up ftp server with pure-ftpd aeruzcar Linux - Software 7 04-15-2004 07:43 AM
Cannot start pure-ftpd kiaraho Linux - Software 2 02-20-2004 11:03 AM
Problems using Pure-FTPd server... mike_hurley Linux - Networking 1 11-12-2003 12:58 PM
perl(script) needed for pure-ftpd hobylinux Linux - Networking 0 08-26-2003 08:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 06:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration