check_inet.sh: replace 'ifconfig' with 'ip addr show'.
This commit is contained in:
parent
84c2c5582b
commit
e0f89eecd5
@ -6,7 +6,7 @@ device=${1:-"ppp0"}
|
|||||||
|
|
||||||
provider=${2:-"dsl-provider"}
|
provider=${2:-"dsl-provider"}
|
||||||
|
|
||||||
ptp_addr=`ifconfig $device 2>/dev/null | grep -e "P-[tz]-P" | cut -d":" -f3 | cut -d " " -f1`
|
ptp_addr="$(ip addr show $device | grep peer | awk '{print$4}' | cut -d '/' -f1)"
|
||||||
|
|
||||||
alternate_addr="google.com heise.de debian.org ubuntu.com"
|
alternate_addr="google.com heise.de debian.org ubuntu.com"
|
||||||
|
|
||||||
@ -16,9 +16,9 @@ reconnect() {
|
|||||||
killall -9 pppd
|
killall -9 pppd
|
||||||
sleep 2
|
sleep 2
|
||||||
ifup $provider >/dev/null 2> /dev/null
|
ifup $provider >/dev/null 2> /dev/null
|
||||||
sleep 3
|
sleep 5
|
||||||
ptp_addr=`ifconfig $device 2>/dev/null | grep -e "P-[tz]-P" | cut -d":" -f3 | cut -d " " -f1`
|
ptp_addr="$(ip addr show $device | grep peer | awk '{print$4}' | cut -d '/' -f1)"
|
||||||
if [ "X$ptp_addr" == "X" ] ; then
|
if [[ -z "$ptp_addr" ]] ; then
|
||||||
echo "[ Error ]: reconnection host `hostname --long` failed at `date +\"%d.%m.%Y %H:%M:%S\"`"
|
echo "[ Error ]: reconnection host `hostname --long` failed at `date +\"%d.%m.%Y %H:%M:%S\"`"
|
||||||
else
|
else
|
||||||
echo "[ `hostname --long`]: reconnected at `date +\"%d.%m.%Y %H:%M:%S\"`"
|
echo "[ `hostname --long`]: reconnected at `date +\"%d.%m.%Y %H:%M:%S\"`"
|
||||||
@ -27,7 +27,7 @@ reconnect() {
|
|||||||
echo "`df`"
|
echo "`df`"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "X$ptp_addr" == "X" ] ; then
|
if [[ -z "$ptp_addr" ]] ; then
|
||||||
reconnect
|
reconnect
|
||||||
else
|
else
|
||||||
ping -c3 $ptp_addr >/dev/null 2> /dev/null
|
ping -c3 $ptp_addr >/dev/null 2> /dev/null
|
||||||
|
Loading…
Reference in New Issue
Block a user