net-ftp/pure-ftpd fails to start with the current init script and the --uploadscript option set, possibly due to start-stop-daemon and pure-ftpd both writing to the same pid file (/var/run/pure-ftpd.pid). Because of this, the pid as logged in the file and as reported by "pidof" differ, leading to the function "is_daemon_running" (from /lib/rcscripts/sh/rc-daemon.sh) returning "false" (see the output of "/etc/init.d/pure-ftpd --debug start" with and without --uploadscript set).
Whithout using start-stop-daemon in the start function, the init script works as expected.
This is with sys-apps/baselayout-1.12.9 and net-ftp/pure-ftpd-1.0.21-r1.
Created attachment 115453 [details]
pure-ftpd --debug start *with* --uploadscript
Created attachment 115454 [details]
pure-ftpd --debug start *without* --uploadscript
Created attachment 115455 [details, diff]
patch against pure-ftpd.rc6
Created attachment 118456 [details, diff]
init script patch
The original init script uses start-stop-daemon to create the pid file, but when using --uploadscript it seems to get the pid wrong which causes the init script to fail.
pure-ftpd creates its own pid files anyway so the fix is simply to use these original (and correct) pid files.
I'm having the same problem. The problem is that the actual init script first starts pure-ftpd and then pure-uploadscript.
When starting pure-ftpd with the option -o it seems to look for a running pure-uploadscript. If pure-uploadscript isn't running pure-ftpd fails to start.
The fix is pretty easy. Just test for '-n "$UPLOADSCRIPT"' and start pure-uploadscript before pure-ftpd. ;-)
I'll attach a working init script.
Created attachment 119119 [details]
A working init script. Just moved the pure-uploadscript section above the pure-ftpd section.
Well, after reading the documentation again because of another problem I'm having it seems that pure-ftpd has to be started before pure-uploadscript. I have to admit that my uploadscript doesn't work with my init script but I think/thought that this is due to some file permissions on my filesystem. But with my init script both daemons are started without an error message. So I'm not quite sure.
Created attachment 123963 [details, diff]
Another patch for pure-ftpd init script
If you start default init script with uploadscript enabled it will wait for something and then gives error "Could not launch Pure-FTPd". But if you check the process pure-ftpd (ps ax | grep pure) you see that it is start, but abnormal - not like in documentation (not pure-ftpd [IDLE/SERVER/DOWNLOAD etc]). And netstat -l says that nothing listening ftp port. But if you launch then pure-uploadscript by hand... pure-ftpd will became alive. So the problem is in way pure-ftpd making communication with pure-uploadscript (very strange way... Why not just call this script every time when upload finished?). It looks like pure-ftp not actually starts before pure-uploadscript will start.
So, if make echo $result after calling first start-stop-daemon it returns 1 - (start-stop-daemon --help says that 1 - nothing done). I.e. start-stop-daemon for some reason identifies "frosen" pure-ftpd starter-process as dead and reports that nothing was done. But start-stop-daemon has option --oknodo, witch overrides this, and program will return 0. So this is most correct and simple workaround.
Sorry for bad english. I can repeat this in Russian if it will help =).
The patch on comment #8 correctly address this issue for me.
Fixed in pure-ftpd-1.0.21-r1 using the patch from comment #8 (emerge --sync in a few hours to get the updated ebuild), thanks for your contribution!
Best regards, CHTEKK.