Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 785 → Rev 786

/scripts/alcasar-watchdog.sh
16,7 → 16,11
 
EXTIF="eth0"
INTIF="eth1"
PRIVATE_IP="192.168.182.1"
macallowed_file="/usr/local/etc/alcasar-macallowed"
conf_file="/usr/local/etc/alcasar.conf"
private_ip_mask=`grep PRIVATE_IP= $conf_file|cut -d"=" -f2`
private_ip_mask=${private_ip_mask:=192.168.182.1/24}
PRIVATE_IP=`echo $private_ip_mask | cut -d"/" -f1` # ALCASAR LAN IP address
tmp_file="/tmp/watchdog.txt"
DIR_WEB="/var/www/html"
Index_Page="$DIR_WEB/index.php"
109,8 → 113,15
arp_reply=`/usr/sbin/arping -b -I$INTIF -s$PRIVATE_IP -c1 -w4 $noresponse_ip|grep response|cut -d" " -f2`
if [[ $(expr $arp_reply) -eq 0 ]]
then
logger "alcasar-watchdog $noresponse_ip ($noresponse_mac) can't be contact. Alcasar disconnects the user."
/usr/sbin/chilli_query logout $noresponse_mac
mac_allowed=`cat $macallowed_file |grep $noresponse_mac | wc -l`
if [ $mac_allowed -eq 0 ]
then
logger "alcasar-watchdog $noresponse_ip ($noresponse_mac) can't be contact. Alcasar disconnects the user."
/usr/sbin/chilli_query logout $noresponse_mac
else
logger "alcasar-watchdog $noresponse_ip ($noresponse_mac - macallowed) can't be contact. Alcasar release the IP address"
/usr/sbin/chilli_query dhcp-release $noresponse_mac
fi
fi
done
rm $tmp_file