On Friday 04 September 2009 11:23:09 Willie Wong wrote: > On Fri, Sep 04, 2009 at 10:51:14AM +0200, Penguin Lover J. Roeleveld squawked: > > Does anyone know if an existing method to have init-scripts on server A > > wait for a service on server B to be started? > > I have no idea if this would work or not. But have you tried writing a > init script that does nothing but polls for the service and only > exits when succeeds? Then you can edit the scripts for the dependent > services to require it to start after your polling script.
I have been thinking of something similar, but before starting to write this myself, I wanted to double check if anyone has a better idea and/or already knows of a set of scripts/tools that already implement this. > Something like: script /etc/init.d/foo polls tries for database > connection. Inside it is a time-delayed loop that tries until it > succeeds. Edit /etc/init.d/apache (assuming you are using it for your > webserver) to 'need foo' Or, obviously, fails if it doesn't come up within a certain (configurable) time. > Again, I am just throwing this out randomly. Let me know if it works > at all ;p If there is no existing set of scripts, I will share whatever I come up with. > Best of luck, Thanks, Joost