Subversion Repositories ALCASAR

Rev

Rev 958 | Rev 988 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 958 Rev 987
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-watchdog.sh 958 2012-07-19 09:01:30Z franck $
2
# $Id: alcasar-watchdog.sh 987 2012-08-17 21:41:28Z richard $
3
 
3
 
4
# alcasar-watchdog.sh
4
# alcasar-watchdog.sh
5
# by Rexy
5
# by Rexy
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
7
 
Line 30... Line 30...
30
# users are redirected on ALCASAR IP address if LAN Pb detected
30
# users are redirected on ALCASAR IP address if LAN Pb detected
31
{
31
{
32
	case $LAN_DOWN in
32
	case $LAN_DOWN in
33
	"1")
33
	"1")
34
		logger "eth0 link down"
34
		logger "eth0 link down"
-
 
35
		echo "eth0 is down"
35
		/bin/sed -i "s?diagnostic =.*?diagnostic = \"eth0 link down\";?g" $Index_Page
36
		/bin/sed -i "s?diagnostic =.*?diagnostic = \"eth0 link down\";?g" $Index_Page
36
		;;
37
		;;
37
	"2")
38
	"2")
38
		logger "can't contact the default router"
39
		logger "can't contact the default router"
-
 
40
		echo "can't contact the default router"
39
		/bin/sed -i "s?diagnostic =.*?diagnostic = \"can't contact the default router\";?g" $Index_Page
41
		/bin/sed -i "s?diagnostic =.*?diagnostic = \"can't contact the default router\";?g" $Index_Page
40
		;;
42
		;;
41
	esac
43
	esac
42
	net_pb=`cat /etc/dnsmasq.conf|grep "address=/#/"|wc -l`
44
	net_pb=`cat /etc/dnsmasq.conf|grep "address=/#/"|wc -l`
43
	if [ $net_pb = "0" ] # on alerte les usagers (si ce n'est pas déjà le cas).
45
	if [ $net_pb = "0" ] # on alerte les usagers (si ce n'est pas déjà le cas).
Line 78... Line 80...
78
	if [ $LAN_DOWN != "0" ]
80
	if [ $LAN_DOWN != "0" ]
79
		then
81
		then
80
			lan_down_alert
82
			lan_down_alert
81
	# else switch in normal mode
83
	# else switch in normal mode
82
	else
84
	else
-
 
85
		echo "Internet access is OK for now"
83
		net_pb=`cat /etc/dnsmasq.conf|grep "address=/#/"|wc -l`
86
		net_pb=`cat /etc/dnsmasq.conf|grep "address=/#/"|wc -l`
84
		if [ $net_pb != "0" ]
87
		if [ $net_pb != "0" ]
85
			then
88
			then
86
			/bin/sed -i "s?^\$network_pb.*?\$network_pb = False;?g" $Index_Page
89
			/bin/sed -i "s?^\$network_pb.*?\$network_pb = False;?g" $Index_Page
87
			/bin/sed -i "s?^address=\/#\/.*?conf-dir=/usr/local/etc/alcasar-dnsfilter-enabled?g" /etc/dnsmasq-blackhole.conf
90
			/bin/sed -i "s?^address=\/#\/.*?conf-dir=/usr/local/etc/alcasar-dnsfilter-enabled?g" /etc/dnsmasq-blackhole.conf