do not remove lock if we were not the ones to aquire it...
This commit is contained in:
parent
e5bf87c7ab
commit
f56efb0085
@ -181,8 +181,13 @@ def main():
|
||||
resfile = os.path.join(libdir, 'result')
|
||||
|
||||
success = True
|
||||
has_lock = True
|
||||
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)
|
||||
else:
|
||||
has_lock = aquire_lock(lckfile)
|
||||
if has_lock:
|
||||
res = exec_command(args, o, e, r)
|
||||
else:
|
||||
e.write("CRONWRAPPER: Unable to aquire lock, previous instance still running?\n")
|
||||
@ -249,6 +254,7 @@ def main():
|
||||
print("Cronjob failed\n")
|
||||
print_runs([libdir], clean=False)
|
||||
|
||||
if has_lock:
|
||||
release_lock(lckfile)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user