Debugging init scripts.

Markus Schönhaber ubuntu-server at list-post.mks-mail.de
Fri Nov 27 20:24:31 UTC 2009


27.11.2009 13:51, Jarl Friis:

> I have written some innit scripts to start and stop some virtual
> machines.

> However the scripts does not seem to run at boot. How can I debug to
> figure out what is going on.
> 
> There seems to be a problem that prevents logging of startup activity,
> hence I can see no trace of problem in this script.
> 
> What is the best approach forward to find the problem?

The most obvious things to check, which you probably have already done:
- Is the script's executable bit set?
- Does it work if you start it manually?

Provided the answer to both questions is "yes", my brute-force approach
would be to print logging messages to a file - for example by using echo
- or to the console - for example by using echo or the log_* functions
/lib/lsb/init-functions provides.
Even mor brute force - but useful if nothing else helps - would be
setting the shebang to
#!/bin/sh -x
which prints each statement before it gets executed.

One more thing: you don't use some bashisms in your script while the
shebang points to /bin/sh? /bin/sh since Hardy (IIRC) is dash not bash.




More information about the ubuntu-server mailing list