Skip to content

Instantly share code, notes, and snippets.

@Falci
Created July 13, 2020 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Falci/73b8298f97a3b1ce55aaaac6844e38a2 to your computer and use it in GitHub Desktop.
Save Falci/73b8298f97a3b1ce55aaaac6844e38a2 to your computer and use it in GitHub Desktop.
#!/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
*/5 * * * * /root/scripts/check_ip >/dev/null 2>&1
#!/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