public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] How to have init-scripts 'wait' for other servers
@ 2009-09-04  8:51 J. Roeleveld
  2009-09-04  9:23 ` Willie Wong
  2009-09-04 10:44 ` Carlos
  0 siblings, 2 replies; 5+ messages in thread
From: J. Roeleveld @ 2009-09-04  8:51 UTC (permalink / raw
  To: gentoo-user

Hi all,

Does anyone know if an existing method to have init-scripts on server A wait 
for a service on server B to be started?

Reason for this:
I have one server containing all the databases, one that operates as a NAS and 
the DNS is running on server 3.
In order for the different machines to start correctly, I need to configure it 
that server 3 starts the DNS before the other machines try to access other 
machines (don't want to maintain hosts-files as it all works fine once the 
servers are up and running)

Also need to make sure the database and NAS is running before the webserver 
starts.

I tried to google for it, but I can't find a usefull search string that will 
give me anything usefull.

I don't mind reqriting init-scripts for this, but am looking for a way to 
check if services are up and running from within the init-scripts.

Thanks,

Joost Roeleveld



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] How to have init-scripts 'wait' for other servers
  2009-09-04  8:51 [gentoo-user] How to have init-scripts 'wait' for other servers J. Roeleveld
@ 2009-09-04  9:23 ` Willie Wong
  2009-09-04  9:51   ` J. Roeleveld
  2009-09-04 10:44 ` Carlos
  1 sibling, 1 reply; 5+ messages in thread
From: Willie Wong @ 2009-09-04  9:23 UTC (permalink / raw
  To: gentoo-user

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. 

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'

Again, I am just throwing this out randomly. Let me know if it works
at all ;p

Best of luck, 

W
-- 
Two college graduates are peeing in a bathroom. 

The Harvard grad finishes, goes over and washes his hands very well using 
lots of soap and water, and says "at Harvard, they teach us to be clean."

The Yale grad finishes, and washes his hands with a very small amount
of soap and water and says "at Yale they teach us to conserve resources."

Right then, a Princeton grad walks in, washes his hands thoroughly,
and goes to the urinal, saying "At Princeton, they teach us to wash
our hands before handling a sacred object."
Sortir en Pantoufles: up 1001 days,  8:06



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] How to have init-scripts 'wait' for other servers
  2009-09-04  9:23 ` Willie Wong
@ 2009-09-04  9:51   ` J. Roeleveld
  0 siblings, 0 replies; 5+ messages in thread
From: J. Roeleveld @ 2009-09-04  9:51 UTC (permalink / raw
  To: gentoo-user

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] How to have init-scripts 'wait' for other servers
  2009-09-04  8:51 [gentoo-user] How to have init-scripts 'wait' for other servers J. Roeleveld
  2009-09-04  9:23 ` Willie Wong
@ 2009-09-04 10:44 ` Carlos
  2009-09-04 11:38   ` J. Roeleveld
  1 sibling, 1 reply; 5+ messages in thread
From: Carlos @ 2009-09-04 10:44 UTC (permalink / raw
  To: gentoo-user

J. Roeleveld a écrit :
> Hi all,
> 
> Does anyone know if an existing method to have init-scripts on server A wait 
> for a service on server B to be started?
> 
> Reason for this:
> I have one server containing all the databases, one that operates as a NAS and 
> the DNS is running on server 3.
> In order for the different machines to start correctly, I need to configure it 
> that server 3 starts the DNS before the other machines try to access other 
> machines (don't want to maintain hosts-files as it all works fine once the 
> servers are up and running)
> 
> Also need to make sure the database and NAS is running before the webserver 
> starts.
> 
> I tried to google for it, but I can't find a usefull search string that will 
> give me anything usefull.
> 
> I don't mind reqriting init-scripts for this, but am looking for a way to 
> check if services are up and running from within the init-scripts.
> 
> Thanks,
> 
> Joost Roeleveld

Monit may be able to meet your needs and reduce the amount of work you'd 
have to do to script this up yourself.

http://mmonit.com/monit/

An advantage of not touching the init scripts is that you don't have to 
maintain patches or deal with merge prompts when a package updates it's 
init script.

Regards,
Carlos



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] How to have init-scripts 'wait' for other servers
  2009-09-04 10:44 ` Carlos
@ 2009-09-04 11:38   ` J. Roeleveld
  0 siblings, 0 replies; 5+ messages in thread
From: J. Roeleveld @ 2009-09-04 11:38 UTC (permalink / raw
  To: gentoo-user

On Friday 04 September 2009 12:44:33 Carlos wrote:
> J. Roeleveld a écrit :
> > Hi all,
> >
> > Does anyone know if an existing method to have init-scripts on server A
> > wait for a service on server B to be started?
> >
> > Reason for this:
> > I have one server containing all the databases, one that operates as a
> > NAS and the DNS is running on server 3.
> > In order for the different machines to start correctly, I need to
> > configure it that server 3 starts the DNS before the other machines try
> > to access other machines (don't want to maintain hosts-files as it all
> > works fine once the servers are up and running)
> >
> > Also need to make sure the database and NAS is running before the
> > webserver starts.
> >
> > I tried to google for it, but I can't find a usefull search string that
> > will give me anything usefull.
> >
> > I don't mind reqriting init-scripts for this, but am looking for a way to
> > check if services are up and running from within the init-scripts.
> >
> > Thanks,
> >
> > Joost Roeleveld
>
> Monit may be able to meet your needs and reduce the amount of work you'd
> have to do to script this up yourself.
>
> http://mmonit.com/monit/
>
> An advantage of not touching the init scripts is that you don't have to
> maintain patches or deal with merge prompts when a package updates it's
> init script.
>
> Regards,
> Carlos

I will have a look at this. From the website it looks like it should be able 
to do most of what I need.
Might need to reconfigure a few things (like not starting all services using 
the 'normal' method, but I can live with that as long as monit can still tell 
me what is running and what isn't...

(added bonus, it's in portage: app-admin/monit )

Thanks,

Joost




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-09-04  6:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-04  8:51 [gentoo-user] How to have init-scripts 'wait' for other servers J. Roeleveld
2009-09-04  9:23 ` Willie Wong
2009-09-04  9:51   ` J. Roeleveld
2009-09-04 10:44 ` Carlos
2009-09-04 11:38   ` J. Roeleveld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox