Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-watchdog.sh 1818 2016-04-07 13:38:05Z raphael.pion $
|
2 |
# $Id: alcasar-watchdog.sh 1867 2016-05-04 12:22:08Z raphael.pion $
|
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 112... |
Line 112... |
112 |
noresponse_mac=`echo $noresponse | cut -d" " -f2`
|
112 |
noresponse_mac=`echo $noresponse | cut -d" " -f2`
|
113 |
noresponse_user=`echo $noresponse | cut -d" " -f3`
|
113 |
noresponse_user=`echo $noresponse | cut -d" " -f3`
|
114 |
arp_reply=`/usr/sbin/arping -b -I$INTIF -s$PRIVATE_IP -c1 -w4 $noresponse_ip|grep "Unicast reply"|wc -l`
|
114 |
arp_reply=`/usr/sbin/arping -b -I$INTIF -s$PRIVATE_IP -c1 -w4 $noresponse_ip|grep "Unicast reply"|wc -l`
|
115 |
if [[ $(expr $arp_reply) -eq 0 ]]
|
115 |
if [[ $(expr $arp_reply) -eq 0 ]]
|
116 |
then
|
116 |
then
|
117 |
#on vide les ip inactifs de l'ipset user_not_connected_yet
|
117 |
#on vide les ip inactifs de l'ipset not_auth_yet
|
118 |
ipset del user_not_connected_yet $noresponse_ip
|
118 |
ipset del not_auth_yet $noresponse_ip
|
119 |
logger "alcasar-watchdog $noresponse_ip ($noresponse_mac) can't be contact. Alcasar disconnects the user ($noresponse_user)."
|
119 |
logger "alcasar-watchdog $noresponse_ip ($noresponse_mac) can't be contact. Alcasar disconnects the user ($noresponse_user)."
|
120 |
/usr/sbin/chilli_query logout $noresponse_mac
|
120 |
/usr/sbin/chilli_query logout $noresponse_mac
|
121 |
if [[ $noresponse_user == $noresponse_mac ]] # for @mac auth equipments, we must remove the arp entry
|
121 |
if [[ $noresponse_user == $noresponse_mac ]] # for @mac auth equipments, we must remove the arp entry
|
122 |
then /usr/sbin/chilli_query dhcp-release $noresponse_mac
|
122 |
then /usr/sbin/chilli_query dhcp-release $noresponse_mac
|
123 |
fi
|
123 |
fi
|