15,8 → 15,7 |
PRIVATE_IP="192.168.182.1" |
tmp_file="/tmp/watchdog.txt" |
DIR_WEB="/var/www/html" |
Network_Pb_Page="$DIR_WEB/index-network-pb.php" |
Network_Deny_Page="$DIR_WEB/index-access-deny.php" |
Index_Page="$DIR_WEB/index.php" |
IFS=$'\n' |
|
# Fonction appelée si un Pb de connectivité Internet |
26,21 → 25,21 |
case $EXT_DOWN in |
"1") |
logger "eth0 link down" |
/bin/sed -i "s?diagnostic =.*?diagnostic = eth0 link down?g" $Network_Pb_Page |
/bin/sed -i "s?diagnostic =.*?diagnostic = eth0 link down?g" $Index_Page |
;; |
"2") |
logger "can't contact the default router" |
/bin/sed -i "s?diagnostic =.*?diagnostic = can't contact the default router?g" $Network_Pb_Page |
/bin/sed -i "s?diagnostic =.*?diagnostic = can't contact the default router?g" $Index_Page |
;; |
"3") |
logger "can't contact the Internet DNS" |
/bin/sed -i "s?diagnostic =.*?diagnostic = can't contact the Internet DNS?g" $Network_Pb_Page |
/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" ] |
then |
ln -sf $Network_Pb_Page $DIR_WEB/index.php |
/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 |
/etc/init.d/dnsmasq restart |
fi |
74,7 → 73,7 |
net_pb=`cat /etc/dnsmasq.d/alcasar-dnsmasq.conf|grep "address=/#/"|wc -l` |
if [ $net_pb -eq "1" ] |
then |
ln -sf $Network_Deny_Page $DIR_WEB/index.php |
/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 |
/etc/init.d/dnsmasq restart |
fi |