Skip to content

Instantly share code, notes, and snippets.

@soffchen
Last active June 24, 2016 09:07
Show Gist options
  • Save soffchen/4ca6f81b6dce20f88ba3dcda4065ce9d to your computer and use it in GitHub Desktop.
Save soffchen/4ca6f81b6dce20f88ba3dcda4065ce9d to your computer and use it in GitHub Desktop.

Revisions

  1. soffchen renamed this gist Jun 24, 2016. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions gistfile1.txt → duckdns.script
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@
    ```
    :global currentIP;
    :local newIP [/ip address get [find interface="cnc"] address];
    :local newIP [:pick $newIP 0 [:find $newIP "/"]];
    @@ -8,5 +7,4 @@
    /tool fetch mode=https url="https://www.duckdns.org/update?domains=xxx&token=xxx&ip=$newIP" dst-path=duckdns.txt;
    :local result [/file get duckdns.txt contents];
    :log info "Duck DNS update result: $result";
    }
    ```
    }
  2. soffchen created this gist Jun 24, 2016.
    12 changes: 12 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    ```
    :global currentIP;
    :local newIP [/ip address get [find interface="cnc"] address];
    :local newIP [:pick $newIP 0 [:find $newIP "/"]];
    :if ($newIP != $currentIP) do={
    :log info "IP address $currentIP changed to $newIP";
    :set currentIP $newIP;
    /tool fetch mode=https url="https://www.duckdns.org/update?domains=xxx&token=xxx&ip=$newIP" dst-path=duckdns.txt;
    :local result [/file get duckdns.txt contents];
    :log info "Duck DNS update result: $result";
    }
    ```