Linux: Running Scripts on Startup

One of the easiest ways to run a script or command on startup is to use the crontab.

The crontab includes an entry string to let you run a script after reboot or on startup.

Enter the crontab.

crontab -e

Add an item to run on startup.

@reboot <COMMAND OR SCRIPT TO RUN>

My crontab entry is visible below. I used this to start all my scripts on my Pi creation.

Screen Shot 2014-01-26 at 12.30.43 PM

Other startup options include, writing an entry into the bashrc. For the Pi, you could also write an entry in /etc/rc.local. This article discusses actually creating an init.d script for those interested.