Simple string to restart the firewall when a certain firewall rule is present
if ( iptables -L -xn |grep 25 |egrep -i ‘DROP|REJECT’ > /dev/null ); then /etc/init.d/firewall restart; echo `date` >> /root/firewall_restarted; fi
This simple script restarts the firewall when there are rules containing 25 and DROP / REJECT. It is meant to restart the firewall when the smpt port is filtered. Not very precise but simple and useful in some cases
It logs all the restarts in the file /root/firewall_restarted.