Posted in Administration, IT, Linux, Posts-EN, Small Notes on December 7th, 2008 by admin
This is very simple bash script for connection test. Sometimes we need do networking restart if dhcpd server is broken or there is some link problems.
One day I need to know if I allow port 8080 in my firewall and I just type “iptables -n -F INPUT | grep 8080” instead of “iptables -n -L INPUT | grep 8080“. This mistake cut off my machine.
This script check connection to the gw and if the connection is break down it restart firewall and networking. If there is no connection on next check it restart networking and firewall afret 5 minutes.
Implementation
put into root’s crontab:
* * * * * /path/to/check-conn.sh
or as root type:
echo”* * * * * root /path/to/check-conn.sh” > /etc/cron.d/check-conn
chmod 755 /etc/cron.d/check-conn
- Script source: download
Slovak posts
English posts
December 8th, 2008 at 7:25 pm