Created
July 13, 2020 20:55
-
-
Save Falci/73b8298f97a3b1ce55aaaac6844e38a2 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/bash | |
FILE=~/.ip | |
IP=$(curl -s ifconfig.co) | |
OLD=$(cat "$FILE"); | |
if [[ "$OLD" == "$IP" ]]; then | |
echo "No IP change"; | |
else | |
echo "IP changed"; | |
echo $IP > $FILE; | |
./update_bind9 $IP | |
fi |
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
*/5 * * * * /root/scripts/check_ip >/dev/null 2>&1 |
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=$1 | |
sed "s/IP/$IP/" /etc/bind/zones/db.default.mask | tee /etc/bind/zones/db.default | |
service bind9 restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment