28 lines
463 B
Python
Executable file
28 lines
463 B
Python
Executable file
#! /usr/bin/env python3
|
|
# encoding: utf-8
|
|
|
|
import os
|
|
import sys
|
|
import time
|
|
|
|
locks = set(sys.argv[1:])
|
|
locks_to_remove = set()
|
|
|
|
print(">>> Active locks: %s" %(", ".join(locks)))
|
|
|
|
while locks:
|
|
for lock in locks:
|
|
if not os.path.exists(lock):
|
|
print("--- Releasing %s" %(lock))
|
|
locks_to_remove.add(lock)
|
|
|
|
for lock in locks_to_remove:
|
|
locks.remove(lock)
|
|
|
|
locks_to_remove.clear()
|
|
|
|
if locks:
|
|
time.sleep(5)
|
|
|
|
|
|
print("<<< All locks have been released.")
|