amprolla

devuan's apt repo merger
git clone git://parazyd.org/amprolla.git
Log | Files | Refs | README | LICENSE

commit 807cb3efadbdc2c7fe3bd0b4a66a4ac2be94eb6e
parent 7c32db96981f1271c8941a55ed384256113305ff
Author: parazyd <parazyd@dyne.org>
Date:   Sat,  9 Dec 2017 16:21:44 +0100

make the lockfile path a variable

Diffstat:
Mlib/lock.py | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/lock.py b/lib/lock.py @@ -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()))) @@ -27,4 +29,5 @@ def free_lock(): """ Frees an active lockfile. """ - remove('/tmp/amprolla.lock') + if isfile(lockpath): + remove(lockpath)