09.11.2019, 10:07
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
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