mirror of
https://gitea.blesmrt.net/mikaela/scripts.git
synced 2024-12-01 15:49:40 +01:00
ydns-simple: ready for testing...
This commit is contained in:
parent
aa06ce2eb3
commit
fc9446deff
@ -5,10 +5,15 @@
|
|||||||
# <https://github.com/commx/ydns/blob/master/updater.sh> which is a lot
|
# <https://github.com/commx/ydns/blob/master/updater.sh> which is a lot
|
||||||
# more complex than this.
|
# more complex than this.
|
||||||
|
|
||||||
|
# yDNS details
|
||||||
|
USEREMAIL=""
|
||||||
|
PASSWORD=""
|
||||||
|
HOSTNAME=""
|
||||||
|
|
||||||
# Get IPv4 address
|
# Get IPv4 address
|
||||||
WAN_IP4=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
WAN_IP4=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
||||||
if [ -f $HOME/.wan_ip4-cf.txt ]; then
|
if [ -f $HOME/.wan_ip4-cf.txt ]; then
|
||||||
OLD_WAN_IP4=$(cat $HOME/.wan_ip4-cf.txt)
|
OLD_WAN_IP4=$(cat $HOME/.wan_ip4-ydns.txt)
|
||||||
else
|
else
|
||||||
echo "No file, need IP4"
|
echo "No file, need IP4"
|
||||||
OLD_WAN_IP4=""
|
OLD_WAN_IP4=""
|
||||||
@ -16,17 +21,27 @@ fi
|
|||||||
|
|
||||||
# Get IPv6 address
|
# Get IPv6 address
|
||||||
WAN_IP6=$(dig +short myip.opendns.com AAAA @2620:0:ccc::2)
|
WAN_IP6=$(dig +short myip.opendns.com AAAA @2620:0:ccc::2)
|
||||||
if [ -f $HOME/.wan_ip6-cf.txt ]; then
|
if [ -f $HOME/.wan_ip6-ydns.txt ]; then
|
||||||
OLD_WAN_IP6=$(cat $HOME/.wan_ip6-cf.txt)
|
OLD_WAN_IP6=$(cat $HOME/.wan_ip6-ydns.txt)
|
||||||
else
|
else
|
||||||
echo "No file, need IP6"
|
echo "No file, need IP6"
|
||||||
OLD_WAN_IP6=""
|
OLD_WAN_IP6=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#if [ "$WAN_IP" = "$OLD_WAN_IP" ]; then
|
# Update IPv4
|
||||||
# echo "IP Unchanged"
|
if [ "$WAN_IP4" = "$OLD_WAN_IP4" ]; then
|
||||||
#else
|
echo "IP4 Unchanged"
|
||||||
# echo $WAN_IP > $HOME/.wan_ip-cf.txt
|
else
|
||||||
# echo "Updating DNS to $WAN_IP"
|
echo $WAN_IP4 > $HOME/.wan_ip4-ydns.txt
|
||||||
# curl -s https://www.cloudflare.com/api.html?a=DIUP\&hosts="$cfhost"\&u="$cfuser"\&tkn="$cfkey"\&ip="$WAN_IP" > /dev/null
|
echo "Updating DNS to $WAN_IP4"
|
||||||
#fi
|
curl -4 --basic -u"$USEREMAIL:$PASSWORD" --silent https://ydns.eu/api/v1/update/?host=$HOSTNAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update IPv6
|
||||||
|
if [ "$WAN_IP6" = "$OLD_WAN_IP6" ]; then
|
||||||
|
echo "IP6 Unchanged"
|
||||||
|
else
|
||||||
|
echo $WAN_IP6 > $HOME/.wan_ip6-ydns.txt
|
||||||
|
echo "Updating DNS to $WAN_IP6"
|
||||||
|
curl -6 --basic -u"$USEREMAIL:$PASSWORD" --silent https://ydns.eu/api/v1/update/?host=$HOSTNAME
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user