gluon-autoupdater: add locking to ensure no two instances of the autoupdater run in parallel

This commit is contained in:
Matthias Schiffer 2014-07-21 16:27:41 +02:00
parent bb2adefd34
commit a39f527dad
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,5 @@
#!/bin/sh
lock /var/gluon/autoupdater.lock
autoupdater "$@"
lock -u /var/gluon/autoupdater.lock

View File

@ -49,5 +49,5 @@ autoupdater_util.randomseed()
-- Perform updates at a random time between 04:00 and 05:00 -- Perform updates at a random time between 04:00 and 05:00
local f = io.open('/lib/gluon/cron/autoupdater', 'w') local f = io.open('/lib/gluon/cron/autoupdater', 'w')
f:write(string.format('%i 4 * * * /usr/sbin/autoupdater\n', math.random(0, 59))) f:write(string.format('%i 4 * * * /lib/gluon/autoupdater/autoupdate\n', math.random(0, 59)))
f:close() f:close()