May 26, 2010 by Ivan Kristianto
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:
vim /etc/init.d/rc.local
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 80For another distribution like Centos, Redhat or Fedora, please refer to their documentation.




thanks you are marvelous.My server now runs as a router and a webserver .thanks again
- spam
- offensive
- disagree
- off topic
Likeactually /etc/init.d/rc.local just calls /etc/rc.local, so you can edit this last directly
- spam
- offensive
- disagree
- off topic
LikeThanks for the tip! That worked like a champ. I needed to load the No-IP update daemon at startup.
- spam
- offensive
- disagree
- off topic
LikeIt doen't work in Lucid. Lucid ignores rc.local, I don't know why.
- spam
- offensive
- disagree
- off topic
LikeProbably, because Ubuntu uses Upstart, the new SysV init replacement.
- spam
- offensive
- disagree
- off topic
LikeTry to use /etc/init.d/rc.local stop|start to see if it works.
It has worked fine to me
- spam
- offensive
- disagree
- off topic
Like