Skip to content

Instantly share code, notes, and snippets.

@heyarne
Created February 19, 2018 14:16
Show Gist options
  • Save heyarne/79a13a8d99a929f8cdc34a82c9e715ce to your computer and use it in GitHub Desktop.
Save heyarne/79a13a8d99a929f8cdc34a82c9e715ce to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
LOG="/var/log/update-dyndns.log"
USER="DYNDNS2_USER"
PASS="DYNDNS2_PASS"
URL="DYNDNS2_ENDPOINT"
exec > >(tee -i ${LOG})
exec 2>&1
echo '#### Starting dyndns update'
echo $(date)
CURRENT_IP=$(curl -sS https://eu.httpbin.org/ip | grep -oP '(\d{1,3}\.?){4}')
curl -sS "https://${USER}:${PASS}@${URL}/update?myip=${CURRENT_IP}"
echo ''
echo '### Update done'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment