0

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
Alexander
  • 125
  • 4

1 Answers1

1

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

user9517
  • 115,471
  • 20
  • 215
  • 297
  • 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