version 1.6, 2010/08/18 10:40:25
|
version 1.7, 2010/08/18 11:38:24
|
Line 1
|
Line 1
|
#!/bin/bash |
#!/bin/bash |
|
|
# switchhgate 0.0.3 |
# switchhgate 0.0.4 |
# (c) 2005 under GPL by Adrian Zaugg |
# (c) 2005-2010 under GPL by Adrian Zaugg |
|
|
# switchgate pings a set of hosts to determine the state of the internet connectivity. If |
# switchgate pings a set of hosts to determine the state of the internet connectivity. If |
# the connection is down, it can change the default gateway to an alternative gateway. |
# the connection is down, it can change the default gateway to an alternative gateway. |
Line 18 DHCP_TMP_DIR=/tmp/switchgate
|
Line 18 DHCP_TMP_DIR=/tmp/switchgate
|
|
|
# eMail address to send alert messages, if not operating on the |
# eMail address to send alert messages, if not operating on the |
# standard default gateway |
# standard default gateway |
ALERT_EMAIL="adi@ente.limmat.ch, hauswartung@dasdreieck.ch" |
ALERT_EMAIL="adi@ente.limmat.ch" |
|
|
# Host set to ping. A file containing IP addresses, each on a single line. |
# Host set to ping. A file containing IP addresses, each on a single line. |
# Do not include any local hosts, list only hosts located behind your gateways. |
# Do not include any local hosts, list only hosts located behind your gateways. |
Line 28 HOSTSET_FILE="$CONFIG_PATH/hostset"
|
Line 28 HOSTSET_FILE="$CONFIG_PATH/hostset"
|
GATEWAYS_FILE="$CONFIG_PATH/gateways" |
GATEWAYS_FILE="$CONFIG_PATH/gateways" |
|
|
# path to fping |
# path to fping |
PING=/usr/sbin/fping |
PING=/usr/bin/fping |
|
|
# answer of fping to reachable hosts |
# answer of fping to reachable hosts |
ALIVE_ANSWER="is alive" |
ALIVE_ANSWER="is alive" |
Line 370 elif [ "$CURRENTGW_ID" != 0 ]; then
|
Line 370 elif [ "$CURRENTGW_ID" != 0 ]; then
|
fi |
fi |
fi |
fi |
|
|
if [ "$DEBUG" = "low" ]; then |
if [ "$DEBUG" = "low" -o "$DEBUG" = "choke" ]; then |
echo |
if [ -n "$UP" ]; then |
echo "Current Default Gateway: $CURRENTGW ($CURRENTGW_ID)" |
echo |
echo |
echo "Current Default Gateway: $CURRENTGW ($CURRENTGW_ID)" |
|
echo |
|
else |
|
echo |
|
echo "No connection." |
|
echo |
|
fi |
fi |
fi |
exit 0 |
exit 0 |