tmake the lockfile path a variable - amprolla - devuan's apt repo merger (HTM) git clone git://parazyd.org/amprolla.git (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 807cb3efadbdc2c7fe3bd0b4a66a4ac2be94eb6e (DIR) parent 7c32db96981f1271c8941a55ed384256113305ff (HTM) Author: parazyd <parazyd@dyne.org> Date: Sat, 9 Dec 2017 16:21:44 +0100 make the lockfile path a variable Diffstat: M lib/lock.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- (DIR) diff --git a/lib/lock.py b/lib/lock.py t@@ -11,15 +11,17 @@ import sys from lib.log import info +lockpath = '/run/lock/amprolla.lock' + def check_lock(): """ Checks if a lockfile is active, and creates one if not. """ - if isfile('/tmp/amprolla.lock'): + if isfile(lockpath): info('Lockfile found. Defering operation.') sys.exit(1) - with open('/tmp/amprolla.lock', 'w') as lock: + with open(lockpath, 'w') as lock: lock.write(str(int(time()))) t@@ -27,4 +29,5 @@ def free_lock(): """ Frees an active lockfile. """ - remove('/tmp/amprolla.lock') + if isfile(lockpath): + remove(lockpath)