To execute a script at startup of Ubuntu / Linux mint

Posted: October 3, 2012 in Linux

To execute a script at startup of Ubuntu

Edit /etc/rc.local and add your commands
The script must always end with exit 0

To execute a script upon rebooting Ubuntu

Put your script in /etc/rc0.d
Make it executable (sudo chmod +x myscript)
Note: The scripts in this directory are executed in alphabetical order

The name of your script must begin with K99 to run at the right time.
To execute a script at shutdown

Put your script in /etc/rc6.d
Make it executable (sudo chmod +x myscript)
Note: The scripts in this directory are executed in alphabetical order

The name of your script must begin with K99 to run at the right time.

Advertisements
Comments
  1. Sv-e says:

    I would say that you should make a symbolic link from /etc/init.d to /etc/rc.x

    like this:

    ln -s /etc/init.d/script /etc/rc.x/SxxScript That way you get all options available in your script without having to rewrite it. If a killscript is made /etc/rc.x/SxxScript should be /etc/rc.x/KxxScript instead.

    Best regards Sv-e

  2. I read this piece of writing completely regarding the resemblance of newest and preceding technologies, it’s awesome article.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s