Run Script On Boot Process In Ubuntu
Sometimes you need to run a script on boot process, for example run an iptables config at boot process. So you don’t have to run the script manually every rebooting.
You can run your script on boot process in Ubuntu by adding it to /etc/init.d/rc.local file. Look the steps below.
1. Open /etc/init.d/rc.local file with this command:
2. Add your script that you want to run on boot process there, for example:
sh /home/ivan/iptables.sh echo 'Iptable Configured!'
3. Save the files. And your script will run on boot process.
PS: This steps only work on Ubuntu. If Debian you need to run
update-rc.d filename defaults 80
For another distribution like Centos, Redhat or Fedora, please refer to their documentation.