Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 6331

Summary: daemontools init script needs time to startup
Product: Gentoo Linux Reporter: Dominik Westner <gentoo>
Component: Current packagesAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED FIXED    
Severity: normal CC: radek
Priority: High    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---

Description Dominik Westner 2002-08-11 13:05:24 UTC
as daemontools provide djbdns the startup script needs some time to startup and
provide these services.

As svscan starts in the background following services like ntpdate will get an
error as the dns service is not yet started.

my fix is to put a
sleep 3

in the startup funiction of daemontools
Comment 1 SpanKY gentoo-dev 2002-08-11 13:34:54 UTC
See Bug 6332 for a better fix

*** This bug has been marked as a duplicate of 6332 ***
Comment 2 Dominik Westner 2002-08-11 15:55:08 UTC
6332 does not solve this problem.
For example if 6332 is not applied, ntpd will be started before svscan and ntpdate will 
fail.

If 6332 is applied, nptd will be started after svscan, but ntpdate will still fail, because 
djbdns stated through the daemontools will need some time to start up.
Comment 3 Nick Hadaway 2002-08-15 18:09:16 UTC
If you utilize an ip instead of a name (131.107.1.10 instead of time-
nw.nist.gov) for your ntpdate server, will that avoid the failing DNS lookup?
Comment 4 Dominik Westner 2002-08-15 18:24:18 UTC
mh, that's a work around, but not a fix. Especially it's not guaranteed that the ip addresses 
of ntp servers stay the same. 
I think the better work around is to put someting like sleep 2 in the svc startup script.
Comment 5 Nick Hadaway 2002-10-30 20:12:29 UTC
As I have not come up with a better answer... I will add this to the startup script.

Where should I put the "sleep 2" statement?  Should I put it in the depend()
function so the script sleeps while the "net" services start up?
Comment 6 Dominik Westner 2002-10-31 01:50:36 UTC
I have put it here:

start() {
    ebegin "Starting service scan ..." 
    PATH="/usr/bin:$PATH"
    cd /service
    start-stop-daemon --start --quiet --exec /usr/bin/svscan -- &
    echo $! > /var/run/svscan.pid
    eend $? 
    sleep 2
}   
    
Comment 7 Jeremy Wohl 2002-11-25 19:18:14 UTC
Can I suggest the runit (http://smarden.org/runit/) package and specifically 
the svwaitup utility?  Instead of arbitrary sleeps/stalls, you use the 
following in your ntpd script.

  # svwaitup /service/tinydns /service/dnscache

I assume DJB will integrate something similar, in future.  It's just a good 
idea.
Comment 8 Andrei Ivanov 2003-01-15 02:11:35 UTC
 * Installing the svscan startup file ...
cp: cannot create regular file `/var/tmp/portage/daemontools-0.76-
r2/temp//etc/init.d/svscan': No such file or directory
install: cannot stat `/var/tmp/portage/daemontools-0.76-
r2/temp//etc/init.d/svscan': No such file or directory

:(

Should I worry... ?
Comment 9 Nick Hadaway 2003-01-15 02:36:35 UTC
oops... sorry about that... i have fixed the ebuild.
Comment 10 Martin Holzer (RETIRED) gentoo-dev 2003-05-12 13:46:59 UTC
depscan + rc script should do this :)