Fork me on GitHub
Mar 26 2009

A script to make sure that my IPv6 Tunnel is always on

Please wait

I’m using an IPv6 tunnel using http://go6.net/, and when the internet connection goes down and up after a while, the tunnel just doesn’t refresh it self.
I run it on crontab for every 5 minutes for now :)
My Machine is Gentoo 2008, I guess you need to do some changes for it to work on your distro.
Hope that any one will benefit from it

#!/bin/bash
function restartGW {
	/etc/init.d/gw6c restart
	date >> /var/log/checkipv
}
stat="`/etc/init.d/gw6c status | tr -d ' ' | cut -d':' -f2`"
if [ $stat == 'stopped' ]
then
	restartGW
elif [ $stat == 'started' ]
then
	IPV4connected="`echo $(nc -zv www.google.com 80 2>&1) | cut -d')' -f2 | tr -d ' '`"
	if [ $IPV4connected == "open" ]
	then
		# check ipv6 connectivity
		IPV6connected="`echo $(nc -6zv ipv6.google.com 80 2>&1) | cut -d')' -f2 | tr -d ' '`"
		if [ $IPV6connected == "open" ]
		then
			exit 0;
		else
			restartGW
		fi
	fi
fi
exit 0

Update:
This script is available at github on http://github.com/alaaibrahim/ala-scripts/.


Jan 13 2009

Gentoo Cache Mirror using apache and php

Please wait

When you have more than one gentoo machine, a good thing to do to manimize the bandwidth usage, is to run some local mirrors, so that you would get the file only once, for all the machines.
Continue reading