Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm running 12.04, and I've never really messed with rc.local. First, when I source myscript.sh in rc.local, should it be /path/to/myscript.sh or sh /path/to/myscript.h or does it even matter? Can it be bash -c "/path/to/myscript.sh"?

Second, it is my understanding that during startup, my script will be called with myscript.sh start and during shutdown myscript.sh stop. Is that correct?

Last, if myscript.sh has an infinite loop, will it hang the startup of the machine? (It isn't truly an infinite loop because myscript.sh stop will stop it gracefully) When I run the script from terminal, I use the command myscript.sh start &. Can rc.local do the same or similar?

Right now I have a shell script that accomplishes the same goal but has a true infinite loop and is sourced from .gnomerc. I'm trying to make it a little less "hacky". Thanks.

share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.