Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-29-2003, 08:29 PM   #1
LQ Newbie
Registered: May 2002
Posts: 5

Rep: Reputation: 0
Lightbulb 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?

Old 10-29-2003, 09:14 PM   #2
Senior Member
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
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
Old 11-03-2003, 02:47 PM   #3
LQ Newbie
Registered: May 2002
Posts: 5

Original Poster
Rep: Reputation: 0
Thumbs up

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Run shell script as root automatically elempoimen Linux - Software 8 06-20-2010 01:24 AM
How to run a shell script on boot up? AussieGit Linux - Newbie 4 11-02-2005 06:10 PM
RH8 - how to automatically run iptables rules shell script at boot time nu-B Linux - General 1 10-29-2003 08:38 PM
How do I automatically run at boot an X program or script cmisip Linux - General 4 01-05-2003 06:30 PM
How to start scriptfile(tomcat) automatically at boot-time run fmohideen76 Linux - General 4 07-11-2002 10:44 PM

All times are GMT -5. The time now is 11:40 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration