How to sequence init.d scripts under Ubuntu -


I have some servers and other daemons that I have to start in the right sequence.

I have created init.d scripts from the skeleton script, and they can be installed to start in the proper order using the numbered naming system, but there are some problems:

One server ('server A') needs to initialize a database connection, and then listen to the socket. Another server ('serverb') needs to be connected to that socket, and if the previous process is not listening then the connection will fail. Is there a way to stop the init.d script from terminating the server until the serverA started listening? Server B Init will not start until the server A-Init is finished.

Now, the setup works by serverbabs, just try connectivity again, until it succeeds, but this approach seems fragile. I want a more precise understanding of compelling indexing.

Yes, this is my question I am answering, but this technique proved useful, and I am sharing this kind of problems with someone else.

I have found very useful in waiting for socket or port like an init.d script:

  case "$ 1" initially) echo the phrase 'echo'. Socket - Unix-Connect: / path / to / socket, retrieval = 10, interval = 1 ;;  

Wait till the socket becomes writable. There is no demonstration involved, so it is not executed with the high number of init.d scripts until it finishes.

Using such waiter script will slow down the boot sequence, and thus it is non-optimal, but improved from a very delicate view of sprinkling 'SN NN' statement in a large scripts.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -