added cleanup after while
parent
9de48194c8
commit
f68f842fad
5
all.py
5
all.py
|
|
@ -53,6 +53,7 @@ lockname=locks+"/all.lock"
|
|||
log=open(logs+"/all.log",'a')
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
while True:
|
||||
if not os.path.exists(lockname):
|
||||
lock=open(lockname,'w')
|
||||
|
|
@ -102,4 +103,8 @@ if __name__ == "__main__":
|
|||
else:
|
||||
print('lock file active!!')
|
||||
log.write('lock collision: lock "all" active @ '+time.ctime()+"\n")
|
||||
except KeyboardInterrupt:
|
||||
print("Interrupted")
|
||||
log.write("keyboard-interrupt happened @"+time.ctime()+"\n")
|
||||
os.remove(lockname)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue