16.05.2017, 16:58
(This post was last modified: 16.05.2017, 17:01 by Erwin van der Zwart.)
Hi,
Event based scripts are running in parallel when executed multiple times. To avoid this you need to kill the previous instance of the script. Try using this and fill it up with your original script and make sure to use a unique storage name for each script you use it in:
BR,
Erwin
Event based scripts are running in parallel when executed multiple times. To avoid this you need to kill the previous instance of the script. Try using this and fill it up with your original script and make sure to use a unique storage name for each script you use it in:
Code:
-- check if previous script needs to be killed
storage_name = 'PID_SCRIPT_1'
tpid = storage.get(storage_name)
if tpid == nil then
pid = os.getpid()
storage.set(storage_name, pid)
else
pid = os.getpid()
storage.set(storage_name, pid)
os.kill(tpid, signal.SIGKILL)
end
-- put here your script with os.sleep
os.sleep(10)
-- end of your scrript
-- clean up storage
storage.delete(storage_name)
BR,
Erwin