Create a startup script in ubuntu

Write a script in a text editor. put it in the /etc/init.d/ directory.

Lets say you called it FOO. You then run

sudo update-rc.d FOO defaults

You also have to make the file you created, FOO, executable:

sudo chmod +x /etc/init.d/FOO

19 Responses to “Create a startup script in ubuntu”

  1. hasnain Says:

    Thanks

    you saved my time.

    Regards

    Hasnain

  2. bjorn Says:

    Straight to the point and just what I needed. Thanks!

  3. Njuki Says:

    Thank you very much for this! google lead me to you so i had to leave a message

  4. Dom Says:

    You’re a STAR!

    Been struggling with this for a few hours but now have mp3s streaming around my house every time i reboot the server without any messing around…

    Thanks buddy!

  5. Chris Says:

    Watch out though. If the script you run doesn’t execute correctly, then the system may not complete booting. That’s what happened to me!

  6. Paul Says:

    I’m a newbie to ubuntu and this was excellent!! Thanks

  7. sameer Says:

    thanks,
    will try it on my machine

  8. Craig Says:

    Cool, chears.

  9. edgher Says:

    simple yet useful script..thanks!

  10. Christian Bartels Says:

    Works perfectly. Thanks!

  11. sanchez Says:

    simple, powerful ! thanks

  12. Art Says:

    I did it and I don’t like what I did.
    How can I undo the startup script?

  13. Abraham Says:

    Nice ^_^! I won’t start my wireless connection from a terminal again :P . Blessings and thanks for share!

  14. wrybread Says:

    Thanks, just what I needed.

    To the person requesting info on removing the startup script:

    update-rc.d -f FOO remove

    (The -f switch tells it to force the removal. Was necessary for me, not sure if always.)

  15. junderdo Says:

    cool. auto mounting starcraft right…..meow!

  16. Andrew Cornford Says:

    Thank you so much! That was so very useful!

  17. naveen Says:

    hi,
    will the above command runs the script in background.if not how to do it.becoz my script has infinte while loop

    thanq

  18. Will Says:

    Thanks so much! For some reason my fstab wasn’t keeping any of my changes, so I made a startup script using this tutorial to do the mounting. Worked the first time, and I’d spent hours previously messing with fstab.

  19. BruCe Says:

    Tks a lot my friend!!!

Leave a Reply