Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 3007 → Rev 3008

/scripts/alcasar-watchdog.sh
19,6 → 19,7
private_ip_mask=${private_ip_mask:=192.168.182.1/24}
PRIVATE_IP=`echo $private_ip_mask |cut -d"/" -f1`
PRIVATE_IP=${PRIVATE_IP:=192.168.182.1}
MULTIWAN=`grep ^MULTIWAN= $CONF_FILE|cut -d"=" -f2`
current_users_file="/tmp/current_users.txt" # file containing active users with their "status.php" tab open
DIR_WEB="/var/www/html"
Index_Page="$DIR_WEB/index.php"
48,7 → 49,7
;;
esac
net_pb=`grep "network_pb = true;" $Index_Page|wc -l`
if [ $net_pb = "0" ] # user alert (only the first time)
if [ $net_pb = "0" ] # if previously up
then
/bin/sed -i "s?^\$network_pb.*?\$network_pb = true;?g" $Index_Page
$IPTABLES -I PREROUTING -t nat -i $TUNIF -p udp --dport domain -j REDIRECT --to-port 56
77,12 → 78,15
if [ $GW_EXIST -eq "0" ] # no GW defined !
then
systemctl restart network
else
IP_GW=`/sbin/ip route list|grep ^default|cut -d" " -f3`
arp_reply=`/usr/sbin/arping -I$EXTIF -c1 $IP_GW|grep response|cut -d" " -f2`
if [ $arp_reply -eq "0" ]
else
if [ "$MULTIWAN" == "off" ] || [ "$MULTIWAN" == "Off" ]
then
LAN_DOWN="2"
IP_GW=`/sbin/ip route list|grep ^default|cut -d" " -f3`
arp_reply=`/usr/sbin/arping -I$EXTIF -c1 $IP_GW|grep response|cut -d" " -f2`
if [ $arp_reply -eq "0" ]
then
LAN_DOWN="2"
fi
fi
fi
fi
106,7 → 110,7
else
echo "Internet access is OK for now"
net_pb=`grep "network_pb = true;" $Index_Page|wc -l`
if [ $net_pb != "0" ]
if [ $net_pb != "0" ] # if already down
then
/bin/sed -i "s?^\$network_pb.*?\$network_pb = false;?g" $Index_Page
$IPTABLES -D PREROUTING -t nat -i $TUNIF -p udp --dport domain -j REDIRECT --to-port 56