From 6d19297f5bc09a6eb9d90aab5836fb099fe32783 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Tue, 12 Jun 2018 09:51:44 +0200 Subject: gcron: create the lockfile if it is missing The lockfile for the job may not exist yet. If that is the case, it should be created upon the first time it is accessed. Change-Id: I4da2b3ecdb79cc63ed82cc7bfa026c8f08d4d043 Fixes: bz#1559829 Signed-off-by: Niels de Vos (cherry picked from commit 7005b1a336e483ec150c2f924a618dcfe197db0b) --- extras/snap_scheduler/gcron.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/snap_scheduler/gcron.py b/extras/snap_scheduler/gcron.py index 4a2ae71f62f..b779619f986 100755 --- a/extras/snap_scheduler/gcron.py +++ b/extras/snap_scheduler/gcron.py @@ -88,7 +88,7 @@ def takeSnap(volname="", snapname=""): def doJob(name, lockFile, jobFunc, volname): success = True try: - f = os.open(lockFile, os.O_RDWR | os.O_NONBLOCK) + f = os.open(lockFile, os.O_CREAT | os.O_RDWR | os.O_NONBLOCK) try: fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB) mtime = os.path.getmtime(lockFile) -- cgit