I am creating a few scripts that are being registered to execute on server start on CentOS 6.5.

One of this scripts has a while loop that blocks until it finds a successful start message on the log of another process that is also being started during boot(init.d).

If this service that my script has a dependency on, never logs the successful start to its log file and my script hangs on the while loop forever, will this specific scenario make the operating system completely hang and never start? Is there a timeout setting for init.d scripts?

My scripts are registered to executed on the rc.local file.

  • Why are you checking for the other service to start, instead of letting the init system handle it? Sep 10 '14 at 14:31
  • @MichaelHampton - Because there's a dependency on the service I need to start. It can't be started if other specific process and port are running. It needs to connect with this other process in order to properly start.
    – groo
    Sep 10 '14 at 15:08

If an init.d script doesn't terminate, the normal system start-up will be interrupted indefinitely.

One common solution is to incorporate a counter in the while loop and exit with an error message after a given number of while loops. If you're waiting for an external command that doesn't have a timeout option, have a look at this question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.