(08.12.2018, 23:53)Erwin van der Zwart Wrote: Hi,
Try to use this when having a event based script with os.sleep:
BR,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
Thanks I am not all that in to scripting yet, but i'm learning. Is all i have to do, just to put my script inside this one, or do i have to change something in your script to adapt it to my system?
I just copy paste it like the description says, and it works brilliant (:
Thanks for quick reply!