I have a few servers and other daemons I need to start up in the right sequence.
I have created init.d scripts from the skeleton script, and can install them to start in proper sequence using the numbered naming system, but a few issues remain:
One server ('serverA') needs to initialize a database connection, and then listen on a socket. Another server ('serverB') then needs to connect to that socket, and the connection will fail if the prior process is not yet listening. Is there a way to prevent the init.d script for serverA from terminating until serverA has started listening? The serverB init will not start until the serverA init has terminated.
Right now, the setup works by having serverB just retry the connection until it succeeds, but that approach seems fragile. I would like a more deterministic understanding of how to force the sequencing.