Executing scripts on Linux boot

From PedrosBrainDump

To execute a command as soon as the Linux boot you can simply put it on the /etc/rc.local file.

Usually this file doesn't exists by default so you can create the file and grant execution privileges to it like:

ls -l /etc/rc.local || touch /etc/rc.local ; chmod +x /etc/rc.local

First check if the file exists, if exists ok, nothing to do here, if not we're creating the file after all adding the execution permission.


IMPORTANT

Always remember to put the bang at the beggining of the file, like:

#!/bin/bash