--check for earlier started script with pid PID1 (PID1 must be a uniqe name) tpid = storage.get('PID1') if tpid == nil then pid = os.getpid() storage.set('PID1', pid) else pid = os.getpid() storage.set('PID1', pid) os.kill(tpid, signal.SIGKILL) end