Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.