Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 519 → Rev 520

/scripts/alcasar-watchdog.sh
18,7 → 18,7
IFS=$'\n'
 
# Fonction appelée si un Pb de connectivité Internet
# On fait pointer les usagers sur une page d'erreur
# On fait pointer les usagers sur l'adresse locale
function ext_down_alert ()
{
case $EXT_DOWN in
35,11 → 35,12
/bin/sed -i "s?diagnostic =.*?diagnostic = \"can't contact the Internet DNS\";?g" $Index_Page
;;
esac
net_pb=`cat /etc/dnsmasq.d/alcasar-dnsmasq.conf|grep "address=/#/"|wc -l`
if [ $net_pb != "1" ]
net_pb=`cat /etc/dnsmasq.conf|grep "address=/#/"|wc -l`
if [ $net_pb = "0" ] # on alerte les usagers (si ce n'est pas déjà le cas).
then
/bin/sed -i "s?^\$network_pb.*?\$network_pb = True;?g" $Index_Page
/bin/sed -i "s?^conf-dir=.*?address=\/#\/$PRIVATE_IP?g" /etc/dnsmasq.d/alcasar-dnsmasq.conf
/bin/sed -i "s?^conf-dir=.*?address=\/#\/$PRIVATE_IP?g" /etc/dnsmasq-blackhole.conf
/bin/sed -i "1i\address=\/#\/$PRIVATE_IP" /etc/dnsmasq.conf
/etc/init.d/dnsmasq restart
fi
}
68,12 → 69,13
then
ext_down_alert
else
# sinon, on rebascule en mode normal
net_pb=`cat /etc/dnsmasq.d/alcasar-dnsmasq.conf|grep "address=/#/"|wc -l`
if [ $net_pb -eq "1" ]
# sinon, le cas échéant, on rebascule en mode normal
net_pb=`cat /etc/dnsmasq.conf|grep "address=/#/"|wc -l`
if [ $net_pb != "0" ]
then
/bin/sed -i "s?^\$network_pb.*?\$network_pb = False;?g" $Index_Page
/bin/sed -i "s?^address=\/#\/.*?conf-dir=/usr/local/etc/alcasar-dnsfilter-enabled?g" /etc/dnsmasq.d/alcasar-dnsmasq.conf
/bin/sed -i "s?^address=\/#\/.*?conf-dir=/usr/local/etc/alcasar-dnsfilter-enabled?g" /etc/dnsmasq-blackhole.conf
/bin/sed -i "/^address=/d" /etc/dnsmasq.conf
/etc/init.d/dnsmasq restart
fi
fi
93,7 → 95,7
rm $tmp_file
fi
# on traite chaque équipements connus de chilli
for system in `/usr/sbin/chilli_query list`
for system in `/usr/sbin/chilli_query list |grep -v "\.0\.0\.0"`
do
active_ip=`echo $system |cut -d" " -f2`
active_session=`echo $system |cut -d" " -f5`