do not remove lock if we were not the ones to aquire it...
This commit is contained in:
parent
e5bf87c7ab
commit
f56efb0085
@ -181,13 +181,18 @@ def main():
|
|||||||
resfile = os.path.join(libdir, 'result')
|
resfile = os.path.join(libdir, 'result')
|
||||||
|
|
||||||
success = True
|
success = True
|
||||||
|
has_lock = True
|
||||||
with open(outfile, 'w') as o, open(errfile, 'w+') as e, open(resfile, 'w') as r:
|
with open(outfile, 'w') as o, open(errfile, 'w+') as e, open(resfile, 'w') as r:
|
||||||
if args.no_lock or aquire_lock(lckfile):
|
if args.no_lock:
|
||||||
res = exec_command(args, o, e, r)
|
res = exec_command(args, o, e, r)
|
||||||
else:
|
else:
|
||||||
e.write("CRONWRAPPER: Unable to aquire lock, previous instance still running?\n")
|
has_lock = aquire_lock(lckfile)
|
||||||
r.write("\nFalse\n")
|
if has_lock:
|
||||||
res = False
|
res = exec_command(args, o, e, r)
|
||||||
|
else:
|
||||||
|
e.write("CRONWRAPPER: Unable to aquire lock, previous instance still running?\n")
|
||||||
|
r.write("\nFalse\n")
|
||||||
|
res = False
|
||||||
|
|
||||||
if res in args.success_exit_codes:
|
if res in args.success_exit_codes:
|
||||||
# Possible success, check error output
|
# Possible success, check error output
|
||||||
@ -249,7 +254,8 @@ def main():
|
|||||||
print("Cronjob failed\n")
|
print("Cronjob failed\n")
|
||||||
print_runs([libdir], clean=False)
|
print_runs([libdir], clean=False)
|
||||||
|
|
||||||
release_lock(lckfile)
|
if has_lock:
|
||||||
|
release_lock(lckfile)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
Loading…
Reference in New Issue
Block a user