This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Send an e-mail when the current IP changes
#1
Good morning, I have been searching the Openrb website for a Script through which I get the current IP changes, I am not sure which of the two Script is valid.

I don't know if this script only sends the e-mail if the IP of the LM changes or if the current IP changes:
require('json')

data = io.readproc('if-json')

data = json.decode(data)

ip = data.eth0.inetaddr





ip_old = storage.get('ip_old')

if ip_old == nil then

  storage.set('ip_old', ip)

end



if ip ~= ip_old then

  subject = 'LM IP changed'

  message = 'The new IP is: ' .. ip

  mail('user@example.com', subject, message)

  storage.set('ip_old', ip)
end
 
 - I don't know exactly what we get with this Script
 
 require('json')

 res = io.readproc('if-json')

 res = json.decode(res)

 ip = res.eth0.inetaddr
 alert('Current LM IP is: %s', ip)
 

 
Thank you

BR 

 Josema
Reply
#2
For external IP use this script: https://forum.logicmachine.net/showthrea...668#pid668
Reply
#3
(09.11.2019, 10:19)admin Wrote: For external IP use this script: https://forum.logicmachine.net/showthrea...668#pid668

Thank you very much admin

 Thank you very much admin!

 BR

 Josema
Reply
#4
(09.11.2019, 10:29)josemabera Wrote:
(09.11.2019, 10:19)admin Wrote: For external IP use this script: https://forum.logicmachine.net/showthrea...668#pid668

Thank you very much admin

 Thank you very much admin!

 BR

 Josema
Hi Josema,

Or maybe this is interesting for you since it gives you a lot more information: https://forum.logicmachine.net/showthrea...8#pid14538
Reply


Forum Jump: