Skip to content

Instantly share code, notes, and snippets.

@kevinoconnor7
Last active November 24, 2020 11:07
Show Gist options
  • Save kevinoconnor7/4036347 to your computer and use it in GitHub Desktop.
Save kevinoconnor7/4036347 to your computer and use it in GitHub Desktop.

Revisions

  1. kevinoconnor7 renamed this gist Sep 21, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.sh → c-ddns.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    #!/bin/sh
    WAN_IP=`wget -O - -q http://ifconfig.me/ip`
    WAN_IP=`curl ifconfig.io/ip`
    OLD_WAN_IP=`cat /var/CURRENT_WAN_IP.txt`
    if [ "$WAN_IP" = "$OLD_WAN_IP" ]
    then
  2. kevinoconnor7 created this gist Nov 8, 2012.
    19 changes: 19 additions & 0 deletions gistfile1.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #!/bin/sh
    WAN_IP=`wget -O - -q http://ifconfig.me/ip`
    OLD_WAN_IP=`cat /var/CURRENT_WAN_IP.txt`
    if [ "$WAN_IP" = "$OLD_WAN_IP" ]
    then
    echo "IP Unchanged"
    else
    curl https://www.cloudflare.com/api_json.html \
    -d 'a=rec_edit' \
    -d 'tkn=8afbe6dea02407989af4dd4c97bb6e25' \
    -d '[email protected]' \
    -d 'z=example.com' \
    -d 'id=9001' \
    -d 'type=A' \
    -d 'name=sub' \
    -d 'ttl=1' \
    -d "content=$WAN_IP"
    echo $WAN_IP > /var/CURRENT_WAN_IP.txt
    fi