Gentoo Archives: gentoo-user

From: "J. Roeleveld" <joost@××××××××.org>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] How to have init-scripts 'wait' for other servers
Date: Fri, 04 Sep 2009 04:43:20
Message-Id: 200909041151.44493.joost@antarean.org
In Reply to: Re: [gentoo-user] How to have init-scripts 'wait' for other servers by Willie Wong
1 On Friday 04 September 2009 11:23:09 Willie Wong wrote:
2 > On Fri, Sep 04, 2009 at 10:51:14AM +0200, Penguin Lover J. Roeleveld
3 squawked:
4 > > Does anyone know if an existing method to have init-scripts on server A
5 > > wait for a service on server B to be started?
6 >
7 > I have no idea if this would work or not. But have you tried writing a
8 > init script that does nothing but polls for the service and only
9 > exits when succeeds? Then you can edit the scripts for the dependent
10 > services to require it to start after your polling script.
11
12 I have been thinking of something similar, but before starting to write this
13 myself, I wanted to double check if anyone has a better idea and/or already
14 knows of a set of scripts/tools that already implement this.
15
16 > Something like: script /etc/init.d/foo polls tries for database
17 > connection. Inside it is a time-delayed loop that tries until it
18 > succeeds. Edit /etc/init.d/apache (assuming you are using it for your
19 > webserver) to 'need foo'
20
21 Or, obviously, fails if it doesn't come up within a certain (configurable)
22 time.
23
24 > Again, I am just throwing this out randomly. Let me know if it works
25 > at all ;p
26
27 If there is no existing set of scripts, I will share whatever I come up with.
28
29 > Best of luck,
30
31 Thanks,
32
33 Joost