Send an e-mail when the current IP changes - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Send an e-mail when the current IP changes (/showthread.php?tid=2332) |
Send an e-mail when the current IP changes - josemabera - 09.11.2019 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 RE: Send an e-mail when the current IP changes - admin - 09.11.2019 For external IP use this script: https://forum.logicmachine.net/showthread.php?tid=159&pid=668#pid668 RE: Send an e-mail when the current IP changes - josemabera - 09.11.2019 (09.11.2019, 10:19)admin Wrote: For external IP use this script: https://forum.logicmachine.net/showthread.php?tid=159&pid=668#pid668 Thank you very much admin Thank you very much admin! BR Josema RE: Send an e-mail when the current IP changes - Joep - 11.11.2019 (09.11.2019, 10:29)josemabera Wrote:Hi Josema,(09.11.2019, 10:19)admin Wrote: For external IP use this script: https://forum.logicmachine.net/showthread.php?tid=159&pid=668#pid668 Or maybe this is interesting for you since it gives you a lot more information: https://forum.logicmachine.net/showthread.php?tid=2304&pid=14538#pid14538 |