Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I am trying to get a simple script to run automatically at startup. A friend told me to do this but it did not work. Could someone take a look to see what it is missing?

*(Also I am brand new to linux, so this is pretty foreign to me)

Here is what I was told to do:

In terminal

sudo nano /etc/init.d/

Then enter this text:

sudo python /home/pi/gits/RPi-OBABP/src/ 

save file and then

$ sudo chmod +x /etc/init.d/
$ sudo shutdown -r now
share|improve this question

migrated from Dec 17 '12 at 6:54

This question came from our site for professional and enthusiast programmers.

Use cron. Add this to your crontab:

@reboot path to script

Click here for details: Linux Crontab: 15 Awesome Cron Job Examples

share|improve this answer
I literally just figured it out by putting it in the startup sequence but this method would have been much easier! thanks – Dan Graves Dec 17 '12 at 9:22
thanks for editing. :) – iota Dec 17 '12 at 9:29

You can execute/start scripts/daemons during boot by configuring /etc/rc.local. So theoretically, you can start the daemons in sequential order, by listing them in /etc/rc.local. See if the following works for your situation.


/etc/init.d/mpd start
/etc/init.d/daemon1 start
/etc/init.d/daemon2 start
share|improve this answer
I think your on the right track. However my version of Linux doesn't have /etc/rc.local folder, I have rc0.d through rc6.d and I have tried changing the boot order there, if I am doing it correctly that is. I followed these instructions: – Dan Graves Dec 17 '12 at 6:40
That being said, it still didn't work, so I'm hoping a made a mistake somewhere – Dan Graves Dec 17 '12 at 6:41
What distro are you using? Also, do you have /etc/init.d/rc.local? – fbynite Dec 17 '12 at 6:45
No i don't have that either. I am doing this on a Raspberry Pi mini computer, so its running a version of Debian (I think) called Raspbian – Dan Graves Dec 17 '12 at 6:50
OK so I renamed the file to change the sequence but I need to update it. And here is my rookie-ness showing, can someone look at this and tell me what I'm supose to do? – Dan Graves Dec 17 '12 at 7:07

Since sudo usually prompts you for a password, I don't think you can really do this. I don't know exactly what your script is doing, but I'm assuming that you shouldn't need to be root to run it. Try removing "sudo" from the line "sudo python /home/pi/gits/RPi-OBABP/src/" If that works, I'll help you tidy this up a bit more. Good luck.

share|improve this answer
I tried that, but the script does actually need to be run with sudo. Its on a little Raspberry Pi computer and it has something to do with the GPIO connector that needs sudo I guess. It won't let me run the script without using it – Dan Graves Dec 17 '12 at 3:12
I'm betting something needs to be done to make the script active, perhaps something like sudo /usr/sbin/update-rc.d defaults – Greg A. Woods Dec 17 '12 at 3:50
@GregA.Woods Now we are getting somewhere. When I watch the boot process it tries to start the script but comes up with errors. Would you know why? the script runs perfectly when I start it in the terminal – Dan Graves Dec 17 '12 at 5:17
perhaps if you post the errors you see -- even better add in the missing step that got you this far into your question, then add the errors you see there too. – Greg A. Woods Dec 17 '12 at 5:29
@GregA.Woods here is a screen picture of the errors. – Dan Graves Dec 17 '12 at 5:31

How about trying to create a start script into


I believe the scripts within the rcS.d starting 'S' are executed in the sequential order.

share|improve this answer
I don't have that directory. I have rc0.d thru rc6.d and I found out my OS defult boots with rc2.d so i tried changing the order but it doesn't seem to be working – Dan Graves Dec 17 '12 at 6:52

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.