Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-watchdog.sh 2008 2016-07-25 09:00:46Z raphael.pion $
|
2 |
# $Id: alcasar-watchdog.sh 2075 2016-11-28 17:46:32Z 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 |
# 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 113... |
Line 113... |
113 |
noresponse_mac=`echo $noresponse | cut -d" " -f2`
|
113 |
noresponse_mac=`echo $noresponse | cut -d" " -f2`
|
114 |
noresponse_user=`echo $noresponse | cut -d" " -f3`
|
114 |
noresponse_user=`echo $noresponse | cut -d" " -f3`
|
115 |
data_user=$(/usr/sbin/chilli_query list | grep -v "\.0\.0\.0" | awk '$5 == 1' | grep $noresponse_ip)
|
115 |
data_user=$(/usr/sbin/chilli_query list | grep -v "\.0\.0\.0" | awk '$5 == 1' | grep $noresponse_ip)
|
116 |
if [ $(echo $data_users | wc -l) -eq 1 ] #if it still connected ...
|
116 |
if [ $(echo $data_users | wc -l) -eq 1 ] #if it still connected ...
|
117 |
then
|
117 |
then
|
118 |
if [[ $noresponse_user == $noresponse_mac ]] #we let @mac auth equipments connected
|
118 |
if [[ $noresponse_user != $noresponse_mac ]] # we let @mac auth equipments connected
|
119 |
then
|
119 |
then
|
120 |
#/usr/sbin/chilli_query dhcp-release $noresponse_mac # for @mac auth equipments, we must remove the arp entry
|
- |
|
121 |
echo "MAC authentification : $noresponse_mac (keep on connection)"
|
- |
|
122 |
else #we disconnect user because status.php has been closed
|
- |
|
123 |
logger "alcasar-watchdog $noresponse_ip ($noresponse_mac) can't be contact. Alcasar disconnects the user ($noresponse_user)."
|
120 |
logger "alcasar-watchdog $noresponse_ip ($noresponse_mac) can't be contact. Alcasar disconnects the user ($noresponse_user)."
|
124 |
echo "Disconnect : $noresponse_ip $noresponse_mac $noresponse_user"
|
121 |
echo "Disconnect : $noresponse_ip $noresponse_mac $noresponse_user"
|
125 |
/usr/sbin/chilli_query logout $noresponse_mac
|
122 |
/usr/sbin/chilli_query logout $noresponse_mac
|
126 |
fi
|
123 |
fi
|
127 |
fi
|
124 |
fi
|
128 |
|
125 |
|
129 |
done
|
126 |
done
|
130 |
rm $tmp_file
|
127 |
rm $tmp_file
|
131 |
if [ -e $tmp_users_file ]; then
|
128 |
# if [ -e $tmp_users_file ]; then
|
132 |
rm $tmp_users_file
|
129 |
# rm $tmp_users_file
|
133 |
fi
|
130 |
# fi
|
134 |
|
131 |
|
135 |
fi
|
132 |
fi
|
136 |
|
133 |
|
137 |
#this temporary file contains every 'user IP address' which are connected to ALCASAR (status.php still open)
|
134 |
#this temporary file contains every 'user IP address' which are connected to ALCASAR (status.php still open)
|
138 |
if [ -e $tmp_users_file ]; then
|
135 |
if [ -e $tmp_users_file ]; then
|