LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   restart iptables from shell script hangs unitl button is pressed (http://www.linuxquestions.org/questions/programming-9/restart-iptables-from-shell-script-hangs-unitl-button-is-pressed-841181/)

saiyen2002 10-29-2010 10:11 AM

restart iptables from shell script hangs unitl button is pressed
 
I am trying to restart iptables from within a shell script. I guess I am missing something very basic since I stripped the shell script down to just the iptables restart command yet still I am having problems.

What happens is that the iptabels starts the restart process but hangs at 'Unloaded iptables modules:'.

It will stay there forever until any key is pressed, after that it completes the restart.

my file test.sh looks like this

Code:

#!/bin/bash

/etc/init.d/iptables restart

The output looks like the following

Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: mangle filter nat [ OK ]
Unloading iptables modules:
[ OK ]
Applying iptables firewall rules: [ OK ]
Loading additional iptables modules: ip_conntrack_netbios_n[ OK ]

I am using Centos 5.4 2.6.18-164.el5. I am executing the script as root

feinbein 10-30-2010 04:17 AM

Just a dirty hack but can you try instead:
Code:

#!/bin/bash

/etc/init.d/iptables stop
/etc/init.d/iptables start


saiyen2002 10-31-2010 05:39 PM

feinbein, I tried what you said, but it still hangs at unloading iptables modules.

I have noticed that this is something which is only relative to the boxes that I am working on, which is my test environment.

Iptables restarts fine within my live environment, which uses centos 5.5 instead of centos 5.4, which is my test environemnt

dive 10-31-2010 06:19 PM

Do you really _need_ to unload the modules on stop?

saiyen2002 11-01-2010 12:12 PM

What I _need_ to do is to restart the iptables.
doing that via the init script involves unloading the module.

Is there another way to do this?


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