How to use Init scripts

A quick dirty guide to init scripts on ubuntu

Start with the file /etc/init.d/skeleton. It’s a template you can use that is already LSB compliant and contains all of the good stuff.

Make a copy and modify as you need

sudo cp /etc/init.d/skeleton /etc/init.d/myscript
sudo nano /etc/init.d/myscript

Make it executable

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

execute this command to add your new script to the list of default services to start on boot.

sudo update-rc.d myscript defaults

if you ever want to delete the service, invoke update-rc.d again

sudo update-rc.d -f myscript remove

Related Reading

One comment on “How to use Init scripts

  1. You’re a really useful site; could not make it
    without ya!

Troll this Post

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s