update_ip: add offline check, for my faulty wireless card
This commit is contained in:
parent
7e0f3c64c5
commit
ed2cf77afc
10
update_ip.sh
10
update_ip.sh
@ -1,11 +1,19 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
ping -qc 1 "${server}" > /dev/null
|
||||||
|
if [ ${?} != 0 ]; then
|
||||||
|
# We are offline
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
cache=.update_ip.cache
|
cache=.update_ip.cache
|
||||||
server=ns1.example.com
|
server=ns1.example.com
|
||||||
zone=dyn.example.com
|
zone=dyn.example.com
|
||||||
host=desktop
|
host=desktop
|
||||||
secret=""
|
secret=""
|
||||||
iface=$( ip route get $( dig +short ${server} | grep [0-9] ) | grep -Po '(?<=(dev ))(\S+)' )
|
|
||||||
|
server_ip=$( dig +short ${server} | grep [0-9] | head -1 )
|
||||||
|
iface=$( ip route get ${server_ip} | grep -Po '(?<=(dev ))(\S+)' )
|
||||||
|
|
||||||
# TODO trigger not via cron, but using ip monitor in a while/sleep loop:
|
# TODO trigger not via cron, but using ip monitor in a while/sleep loop:
|
||||||
#ip monitor address dev ${iface} | while read event; do
|
#ip monitor address dev ${iface} | while read event; do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user