Method 1: Linux Execute Cron Job After System Reboot
Use @reboot in cron scheduler. It will run once, at startup after reboot your system.Edit crontab
# crontab -e
To run a script called /home/huuphan/auto_excute.sh
@reboot /home/huuphan/auto_excute.sh
Method 2: Using /etc/rc.d/rc.local file
This method is vaild for systemd-based distributions. To grant execute permission to /etc/rc.d/rc.local# chmod +x /etc/rc.d/rc.local
And add your script at the bottom of the file /etc/rc.d/rc.local
# echo "/home/huuphan/auto_excute.sh" >> /etc/rc.d/rc.local
Conclusion
In this article, how to Run bash script on boot time on centos. Use two method: Crontab and /etc/rc.d/rc.local file.Thanks for reading Run bash script on boot time on centos My blog Zimbra Mail Server,linux,bash script,centos,linux command I hope this is useful.