Script to Monitor Remote System - - 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: Script to Monitor Remote System - (/showthread.php?tid=4280) |
Script to Monitor Remote System - - jamesng - 03.10.2022 Hi I have a script which I use to monitor the zones in a remote alarm system. It's a looping script which processes the data coming in from a socket connection. I need one instance of the script running continuously. What's the best place to locate this (script below) - is it as a resident script with a 0 interval time or as an init script or somewhere else? Many thanks in advance Kind Regards, James Code: -- Initialise socket connection RE: Script to Monitor Remote System - - admin - 03.10.2022 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 RE: Script to Monitor Remote System - - jamesng - 03.10.2022 Thanks for the script refinements. I’m still a little confused - if this shouldn’t be run a resident or Init script then what type of script would you suggest I create this as? Kind Regards James RE: Script to Monitor Remote System - - admin - 03.10.2022 I've never said it shouldn't be a resident script. Resident script is exactly what is needed for such task. RE: Script to Monitor Remote System - - jamesng - 03.10.2022 But won’t multiple instances of the same script running cause issues / use up all the available device memory? What time interval would you suggest or modifications to the script to avoid the above? Kind Regards James RE: Script to Monitor Remote System - - admin - 04.10.2022 You can run multiple instances without any issues. Sleep interval must be set to 0 in this case. Most of the time the script is in a suspended state waiting for data to arrive so it does not consume CPU resources. RE: Script to Monitor Remote System - - jamesng - 04.10.2022 Thanks for clarifying. Many thanks. |