LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 02-07-2010, 11:33 AM   #1
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Rep: Reputation: 30
iptables never saved and boot file


The last few times I had to restart my server, my iptables file was never saved and I had to load it from the backup. I always issue /etc/init.d/iptables save after any changes but for some reason it loads the default iptables file that came with the server.

Any ideas on what to change?

I would also like to use a default boot file that starts or restarts services like squid, nscd, postfix, iptables, etc - where can I edit that?
 
Old 02-07-2010, 12:31 PM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
man iptables says "SEE ALSO: iptables-save iptables-restore"
so I think /etc/init.d/iptables save is maybe not the way to do it (which is why it does not work).

Quote:
I would also like to use a default boot file that starts or restarts services like squid, nscd, postfix, iptables, etc - where can I edit that?
I am not acquainted with Centos but you need to google for system services centos which I just did, and found this
 
Old 02-07-2010, 01:17 PM   #3
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Original Poster
Rep: Reputation: 30
I have created an executable file called rc.defaultservices in the /etc/rc.d folder

Quote:
service squid restart
service nscd restart
service postfix restart
service httpd restart
service sshd restart
service mysqld restart
iptables-restore < /etc/sysconfig/firewall-backup.conf
How does that look?
I assume anything beginning rc. in that folder will get picked up on reboot?
 
Old 02-07-2010, 01:57 PM   #4
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
No. Sorry but you are not doing this the "right" way.
Ugly hacks are OK (it's your machine), but it is better to follow the agreed "right way" (even though this changes all the time )

If you read the files in /etc/rc.d you'll see they are all shell scripts relating to services that expect an argument like start stop or restart
What they then do depends on the argument they are passed.

In /etc/ you'll see rc0.d rc1.d ... rc6.d rcS.d
rcS.d is for "Single user" or "Rescue mode". The other numbers refer to "runlevels"

Within these rcX.d directories are (or are not) symbolic links to the files in /etc/rc.d/
Whether there is a link or not, depends on whether you want a particular service to start or stop in that runlevel.

Runlevel 0 is generally halt
Runlevel 3 or 5 is generally "Run X and a GUI" (it very much depends on your distro)
The other levels are even more distro-dependant.

You could make all these symlinks yourself. It might take you some time.

Better is to read the link I gave you in the post above and learn to use either a GUI application to help you, or the CLI:
Code:
chkconfig --level 345 squid on
That means that squid will be started at boot for runlevels 3, 4 and 5

You need to do a bit more homework, then it'll all become clear.
"Allll right! I get it now, it's a sensible system".

Have fun. report back.
 
  


Reply


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
[SOLVED] iptables help, don't think my changes saved anon091 Linux - Newbie 6 01-13-2010 03:52 PM
Need help to recover Deleted file - (file was saved in doc) Pravab Ubuntu 2 08-17-2008 11:57 AM
Name of the file where services are saved. abhishekrahel Linux - Desktop 1 10-11-2007 12:49 AM
File name where aliases are saved abhishekrahel Linux - Desktop 1 09-18-2007 01:34 AM
Are iptables saved on reboot? drgowans Linux - Security 4 09-13-2003 03:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:56 AM.

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