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#1590193 Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
3808d8d46a
commit
7005b1a336
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user