autoupdater: add lockfile to prevent concurrent runs
This commit is contained in:
parent
515a9f48fb
commit
1acb4b1d3a
|
@ -309,6 +309,18 @@ local function autoupdate(mirror)
|
|||
end
|
||||
|
||||
|
||||
local lockfile = '/var/lock/autoupdater.lock'
|
||||
local lockfd = nixio.open(lockfile, 'w', 'rw-------')
|
||||
|
||||
if not lockfd:lock('tlock') then
|
||||
io.stderr:write(string.format(
|
||||
"Unable to lock file %s. Make sure there is no other instance of the autoupdater running.\n",
|
||||
lockfile, err
|
||||
))
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
|
||||
local mirrors = branch.mirror
|
||||
|
||||
while #mirrors > 0 do
|
||||
|
|
Loading…
Reference in New Issue