Subversion Repositories ALCASAR

Rev

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

Rev 2539 Rev 2830
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-watchdog.sh 2539 2018-04-30 04:37:54Z tom.houdayer $
2
# $Id: alcasar-watchdog.sh 2830 2020-06-04 20:02:48Z rexy $
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
# - Ce script prévient les usagers de l'indisponibilité de l'accès Internet
7
# - Ce script prévient les usagers de l'indisponibilité de l'accès Internet
Line 66... Line 66...
66
		LAN_DOWN="1"
66
		LAN_DOWN="1"
67
	fi
67
	fi
68
	# Default GW testing
68
	# Default GW testing
69
	if [ $LAN_DOWN -eq "0" ]
69
	if [ $LAN_DOWN -eq "0" ]
70
		then
70
		then
71
		IP_GW=`/sbin/ip route list|grep ^default|cut -d" " -f3`
71
		GW_EXIST=`/sbin/ip route list|grep ^default|wc -l`
72
		arp_reply=`/usr/sbin/arping -I$EXTIF -c1 $IP_GW|grep response|cut -d" " -f2`
-
 
73
		if [ $arp_reply -eq "0" ]
72
		if [ $GW_EXIST -eq "0" ] # no GW defined !
74
			then
73
			then
-
 
74
			systemctl restart network
-
 
75
		else	
-
 
76
			IP_GW=`/sbin/ip route list|grep ^default|cut -d" " -f3`
-
 
77
			arp_reply=`/usr/sbin/arping -I$EXTIF -c1 $IP_GW|grep response|cut -d" " -f2`
-
 
78
			if [ $arp_reply -eq "0" ]
-
 
79
				then
75
			LAN_DOWN="2"
80
				LAN_DOWN="2"
-
 
81
			fi
76
		fi
82
		fi
77
	fi
83
	fi
78
	# if LAN pb detected, users are warned
84
	# if LAN pb detected, users are warned
79
	if [ $LAN_DOWN != "0" ]
85
	if [ $LAN_DOWN != "0" ]
80
		then
86
		then