Last active
December 19, 2019 04:46
-
-
Save pacmac/3acc357bef158d7fa875b875c80ec8cb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
LINODE_API_KEY="12345" | |
DOMAIN_ID="12345" | |
SUB_NAME="my.sub.domain.com" | |
WAN_IP=`curl -s ipecho.net/plain`; | |
OLD_WAN_IP=`cat /tmp/CURRENT_WAN_IP.txt` | |
if [ "$WAN_IP" = "$OLD_WAN_IP" ]; then | |
echo "IP Unchanged" | |
else | |
echo $WAN_IP > /tmp/CURRENT_WAN_IP.txt | |
curl -H "Authorization: Bearer $LINODE_API_KEY" -H "Content-Type: application/json" -X POST -d "{\"type\": \"A\",\"target\": \"$WAN_IP\",\"name\": \"$SUB_NAME\"}" https://api.linode.com/v4/domains/$DOMAIN_ID/records; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment