Skip to content

Instantly share code, notes, and snippets.

@dober
Last active May 28, 2019 22:08
Show Gist options
  • Save dober/3015ef808371d6ee33ec712731696ba7 to your computer and use it in GitHub Desktop.
Save dober/3015ef808371d6ee33ec712731696ba7 to your computer and use it in GitHub Desktop.
[mikrotik] ddns update
### set email by cli
/tool e-mail
set address=74.125.131.108 ### smtp.gmail.com
set port=587
set from=mikrotik@domain.tld
set user=gmail_user
set password=gmail_password
### test email
send to=dober@domain.tld subject="email test" body="email test" start-tls=yes
### script
:global ddnshostname "@"
:global ddnsdomain "domain.tld"
:global ddnspass "your_password"
:log info ("DDNS: Updating")
:local str "https://dynamicdns.park-your-domain.com/update\3Fhost=$ddnshostname&domain=$ddnsdomain&password=$ddnspass"
:local IP [:resolve "your_domain"];
/tool fetch url=($str) mode=https keep-result=no
/tool e-mail send to="dober@domain.tld" subject="your_domain" body="Your IP: $IP" start-tls=yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment