First commit
This commit is contained in:
commit
f2c2dfc38a
1 changed files with 40 additions and 0 deletions
40
lp-ddns/usr/local/bin/lp-ddns
Executable file
40
lp-ddns/usr/local/bin/lp-ddns
Executable file
|
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
RECORDID="28378"
|
||||||
|
PASSWORD="pass123"
|
||||||
|
DOMAIN="test.jonathanselea.se"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# DO NOT MODIFY #
|
||||||
|
IP="$(curl -s ipv4.is)"
|
||||||
|
CURRENTIP="$(dig ${DOMAIN} +short)"
|
||||||
|
APIURL="https://freedns.linux.pizza/api/v1/remote/updatepw?record=${RECORDID}&password=${PASSWORD}&content=${IP}"
|
||||||
|
# Making stuff fancy
|
||||||
|
NC='\033[0m'
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
BLUE='\033[0;34m'
|
||||||
|
CYAN='\033[0;36m'
|
||||||
|
LCYAN='\033[0;37m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
# END
|
||||||
|
|
||||||
|
|
||||||
|
echo -e "The current external IP is ${YELLOW}${IP}${NC}"
|
||||||
|
|
||||||
|
if [ "${IP}" == "${CURRENTIP}" ];
|
||||||
|
then
|
||||||
|
echo -e "${GREEN}The current IP matches the record, no need to update.${NC}"
|
||||||
|
else
|
||||||
|
echo -e "${RED}Current IP does not match the record ${CURRENTIP} updating...${NC}"
|
||||||
|
curl ${APIURL}
|
||||||
|
fi
|
||||||
|
|
||||||
|
logger
|
||||||
|
sleep 300
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
Loading…
Reference in a new issue