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.

LM loses network!
#1
Hi everybody ! I have a problem that needs solving! I want to write a script to know when LM loses network and send information to LM's LOG. Or if the network returns, information will also be sent to LM's LOG. I thank everyone who helped me! thank you Smile)
Reply
#2
(29.11.2023, 04:47)phongvucba Wrote: Hi everybody ! I have a problem that needs solving! I want to write a script to know when LM loses network and send information to LM's LOG. Or if the network returns, information will also be sent to LM's LOG. I thank everyone who helped me! thank you Smile)

Hi,
Look at this if can help you.
https://forum.logicmachine.net/showthrea...twork+lost
Best regards Cristian
Reply
#3
Thank you very much !
But what I want is for LM itself to lose internet, and it will report LM's LOG. When the network comes back, it will also report to LM's Log.
I want to check when my LM lost its internet connection. So I need to LOG it. Because when I lose my internet connection, my Gmail or telegram functions don't work anymore Sad
Thank all! Sad
Reply
#4
Create a scheduled script that runs every minute:
Code:
sock = require('socket').tcp()
sock:settimeout(5)
conn = sock:connect('1.1.1.1', 80)
sock:close()

conn = toboolean(conn)
prev = storage.get('connected')

if prev ~= conn then
  storage.set('connected', conn)
  log(conn and 'connected' or 'disconnected')
end
Reply
#5
oh ! Good luck ! Thank so much Admin Smile
Reply


Forum Jump: