08.12.2018, 23:53
(This post was last modified: 08.12.2018, 23:53 by Erwin van der Zwart.)
Hi,
Try to use this when having a event based script with os.sleep:
BR,
Erwin
Try to use this when having a event based script with os.sleep:
Code:
-- Always start your script with this PID check to kill previous instance when needed
tpid = storage.get('PID:' .. _SCRIPTNAME)
if tpid == nil then
pid = os.getpid()
storage.set('PID:' .. _SCRIPTNAME, pid)
else
pid = os.getpid()
storage.set('PID:' .. _SCRIPTNAME, pid)
os.kill(tpid, signal.SIGKILL)
end
-- Put here your normal script with os.sleep()
-- End of script
-- Always end your script with removal of not needed storage data
storage.delete('PID:' .. _SCRIPTNAME)
Erwin