Subversion Repositories ALCASAR

Rev

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

Rev 64 Rev 109
Line 16... Line 16...
16
if [ -e $tmp_file ]; then
16
if [ -e $tmp_file ]; then
17
	cat $tmp_file | while read noresponse
17
	cat $tmp_file | while read noresponse
18
	do
18
	do
19
		noresponse_ip=`echo $noresponse | cut -d" " -f1`
19
		noresponse_ip=`echo $noresponse | cut -d" " -f1`
20
		noresponse_mac=`echo $noresponse | cut -d" " -f2`
20
		noresponse_mac=`echo $noresponse | cut -d" " -f2`
21
		arp_reply=`/usr/sbin/arping -b -I$INTIF -s$PRIVATE_IP -c1 $noresponse_ip|grep response|cut -d" " -f2`
21
		arp_reply=`/usr/sbin/arping -b -I$INTIF -s$PRIVATE_IP -c1 -w4 $noresponse_ip|grep response|cut -d" " -f2`
22
		if [[ $(expr $arp_reply) -eq 0 ]]
22
		if [[ $(expr $arp_reply) -eq 0 ]]
23
	       	then
23
	       	then
24
			logger "alcasar-watchdog $noresponse_ip ($noresponse_mac) reste muette. On déconnecte."
24
			logger "alcasar-watchdog $noresponse_ip ($noresponse_mac) reste muette. On déconnecte."
25
			/usr/sbin/chilli_query logout $noresponse_mac
25
			/usr/sbin/chilli_query logout $noresponse_mac
26
		fi
26
		fi
Line 31... Line 31...
31
for system in `/usr/sbin/chilli_query list`
31
for system in `/usr/sbin/chilli_query list`
32
do
32
do
33
	active_ip=`echo $system |cut -d" " -f2`
33
	active_ip=`echo $system |cut -d" " -f2`
34
	active_session=`echo $system |cut -d" " -f5`
34
	active_session=`echo $system |cut -d" " -f5`
35
	active_mac=`echo $system | cut -d" " -f1`
35
	active_mac=`echo $system | cut -d" " -f1`
36
# on ne traite que les équipements exploitées par un usager authentifié
36
# on ne traite que les équipements exploitées par un usager authentifié (test de 2 réponses en 4 secondes)
37
if [[ $(expr $active_session) -eq 1 ]]
37
if [[ $(expr $active_session) -eq 1 ]]
38
	then
38
	then
39
	arp_reply=`/usr/sbin/arping -b -I$INTIF -s$PRIVATE_IP -c2 $active_ip|grep response|cut -d" " -f2`
39
	arp_reply=`/usr/sbin/arping -b -I$INTIF -s$PRIVATE_IP -c2 -w4 $active_ip|grep response|cut -d" " -f2`
40
# on stocke les adresses IP des stations muettes
40
# on stocke les adresses IP des stations muettes
41
	if [[ $(expr $arp_reply) -eq 0 ]]
41
	if [[ $(expr $arp_reply) -eq 0 ]]
42
	       	then
42
	       	then
43
			echo "$active_ip $active_mac" >> $tmp_file
43
			echo "$active_ip $active_mac" >> $tmp_file
44
	fi
44
	fi