LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   RH8 - how to automatically run a shell script at boot time (https://www.linuxquestions.org/questions/linux-newbie-8/rh8-how-to-automatically-run-a-shell-script-at-boot-time-110150/)

nu-B 10-29-2003 08:29 PM

RH8 - how to automatically run a shell script at boot time
 
Hi all.

I have created a shell script that sets iptables rules for my firewall. The script works as it should, but now I'd like this script run automatically when linux boots.
Where should I copy it?

Thanks

homey 10-29-2003 09:14 PM

Here is an example. You can name the script something else if you want to.

Do this while logged in as Root
Save the firewall script as /etc/sysconfig/firewall.
Important: Set the permissions for root to read, write and exec. Also, read and exec for group and others.
Something like chomd 755 /etc/sysconfig/firewall aught to do it.

Edit the /etc/rc.d/rc.local file with a path to the script. /etc/sysconfig/firewall
Run the command: service iptables stop
Type: source /etc/sysconfig/firewall
Type: iptables-save > /etc/sysconfig/iptables
Run the command: service iptables restart

nu-B 11-03-2003 02:47 PM

Thanks homey! It worked great for me. I appreciate the help.


All times are GMT -5. The time now is 06:17 PM.