Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im on Ubuntu 10.04. I want to execute script on system boot. I added it to rc.local.

If I execute rc.local manually it works fine. If I boot system in recovery mode(2nd string in boot menu) it also works fine.

But if I boot normally it is not executed. However i added sleep 20 to my script and there is a pause at the end of boot process, but nothing more is executed. Thanks

I think, it soesnt depend on contents of the script but anyway

#!/bin/sh -e

sleep 20
sudo service ssh start
su -c 'service pgsql start' postgres
sudo svnserve -d
su -c 'hamachi start' root
su -c 'hamachi login' root

exit 0
share|improve this question
Show us the script! – adaptr Mar 20 '12 at 9:44
up vote 1 down vote accepted

The delay you see would suggest that your script is being run. In the rc.local add some redirection to capture the output of your script to a file and see if there are any error messages.

 /path/to/your/script  your parameters >/tmp/myscript.out 2>&1 

Now when the system boots any output from you script will be logged to /tmp/myscript.out

share|improve this answer
Isuue resolved. The problem was in the sshd. Somehow it didnt start automatically when booting in recovery mode and that's why script worked fine manually. But in normal boot mode sshd started before rc.local and when trying to start it twice in my script it failed and nothing below didnt execute. – Alexander Mar 20 '12 at 10:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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