Logic Machine Forum
ip public router - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: General (https://forum.logicmachine.net/forumdisplay.php?fid=2)
+--- Thread: ip public router (/showthread.php?tid=159)



ip public router - Angeles - 10.12.2015

Hi:

We have a router with dinamic ip and I wanted to know how to send a message when this changes.


Is this possible?

Thanks


RE: ip public router - admin - 10.12.2015

Add a scheduled script which runs once in an hour or more frequently, depending on your needs:

Code:
http = require('socket.http')
ip = http.request('http://openrb.com/ip')

if ip then
  ip_old = storage.get('lm_ip', '')
  
  if ip ~= ip_old then
     subject = 'LM IP changed'
     message = 'New IP: ' .. ip
     mail('user@example.com', subject, message)
     storage.set('lm_ip', ip)
  end
end