How To Execute Command During Startup in Linux

I will Show is two way to execute command. When the Linux operating system is booting, the first one is the simplest , just enter you command syntax to the file :


First make this file executable bye adding permissions :

chmod +x /etc/rc.d/rc.local

Then just add you line at the bottom of the file . If you are pointing to a script file do not forget to “chmod +x” this script file as well !

The Second option is with cron job , cron scheduler also allows the use of @reboot. This directive, followed by the absolute path to the script, will cause it to run when the machine boots.

Good Luck

Leave a Reply

Your email address will not be published. Required fields are marked *