Created
August 20, 2020 21:14
-
-
Save DRBragg/ad126ae6d8eab23d05c04ec1f26cdcca to your computer and use it in GitHub Desktop.
Little shell script run via cron job to update my google domain to point to my local server.
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/bash | |
| |
IP_ADDR_FILE="ip_addr.txt" | |
old_ip=$(cat $IP_ADDR_FILE) | |
current_ip=$(curl ifconfig.me/ip) | |
| |
if [ "$old_ip" != "$current_ip" ]; then | |
curl "https://username:[email protected]/nic/update?hostname=test.drbragg.ninja&myip=$current_ip" | |
rm $IP_ADDR_FILE | |
touch $IP_ADDR_FILE | |
echo "$current_ip" > $IP_ADDR_FILE | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment