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.

Script to Monitor Remote System -
#2
You can make multiple copies of this script as a resident script with sleep time set to 0. init script should not have any blocking or long-running parts.

Also non-blocking connect should be used and possible errors during receive should be checked:
Code:
if not sock then   sock = require('socket').tcp()   sock:settimeout(1)   res, err = sock:connect('192.168.1.100', 2401)   if not res then     log('connect failed', err)     sock:close()     sock = nil     os.sleep(1)   end end if sock then       res, err = sock:receive('*l')   if res then     -- parse res   elseif err == 'closed' then     log('connection closed')     sock:close()     sock = nil   end end
Reply


Messages In This Thread
RE: Script to Monitor Remote System - - by admin - 03.10.2022, 12:56

Forum Jump: