Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ###########################################################################################################################
- # DUCKDNS SCRIPT
- # Modification Log
- # 2024-06-30 Creation
- # 2024-09-30 dig para comprobar IP cambiada
- ###########################################################################################################################
- #NECESARIO INSTALAR: Curl y dnsutils
- #TELEGRAM PARAMETERS
- APIKEY="*****************************************"
- CHATID="**********"
- #DUCKDNS PARAMETERS
- domain="*******,*******"
- token="*************************************"
- function telegram() {
- curl -s \
- --data parse_mode=HTML \
- --data chat_id=$CHATID \
- --data text="%0A${1}" \
- "https://api.telegram.org/bot$APIKEY/sendMessage"
- }
- ip=$(curl https://api.ipify.org)
- read ip_old < /scr/duckdns/log_ip.txt #CAMBIAR RUTA
- if [ "$ip" != "$ip_old" ]
- then
- OUTPUT=$(curl "https://www.duckdns.org/update?domains=$domain&token=$token&ip=`curl https://api.ipify.org`&verbose=true")
- telegram "$OUTPUT" > /dev/null 2>&1
- ip=$(curl https://api.ipify.org)
- #ip=$(dig *******.duckdns.org +short -4)
- echo "$ip" > /scr/duckdns/log_ip.txt
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement