diff options
-rwxr-xr-x | frontends/cgi/live-build-cgi.cron | 15 | ||||
-rw-r--r-- | frontends/cgi/live-build-cgi.default | 2 |
2 files changed, 10 insertions, 7 deletions
diff --git a/frontends/cgi/live-build-cgi.cron b/frontends/cgi/live-build-cgi.cron index 1b9d460a2..1b0cd90c7 100755 --- a/frontends/cgi/live-build-cgi.cron +++ b/frontends/cgi/live-build-cgi.cron @@ -33,18 +33,21 @@ then set -x fi +# Locknum sets the lock enumeration for multiple instances of l-b-cgi +_LOCKNUM="$(expr 1 + $(expr $(date +%M) % ${_INSTANCES}))" + # Checking lock file -if [ -f /var/lock/live-build-cgi.lock ] +if [ -f /var/lock/live-build-cgi-${_LOCKNUM}.lock ] then - echo "E: live-build-cgi already/still running." + echo "E: live-build-cgi instance ${_LOCKNUM} already/still running." exit 1 fi # Creating lock trap -trap "test -f /var/lock/live-build-cgi.lock && rm -f /var/lock/live-build-cgi.lock; exit 0" 0 1 2 3 9 15 +trap "test -f /var/lock/live-build-cgi-${_LOCKNUM}.lock && rm -f /var/lock/live-build-cgi-${_LOCKNUM}.lock; exit 0" 0 1 2 3 9 15 # Creating lock file -touch /var/lock/live-build-cgi.lock +touch /var/lock/live-build-cgi-${_LOCKNUM}.lock # Cleanup old builds: cron should be run at least once per hour to take effect if ls "${_DESTDIR}"/`date -d yesterday +%Y%m%d.%H`* > /dev/null 2>&1 @@ -58,8 +61,7 @@ fi #if ls "${_TEMPDIR}"/*.build > /dev/null 2>&1 if Find_files ${_TEMPDIR}/*.build then - for _FILE in "${_TEMPDIR}"/*.build - do + _FILE=$(ls "${_TEMPDIR}"/*.build | sort | head -1) # Pull in variables from the build file. . "${_FILE}" @@ -201,5 +203,4 @@ EOF rm -rf "${_TEMPDIR}"/"${_BUILD}" echo "`date +%b\ %d\ %H:%M:%S` ${_HOSTNAME} live-build-cgi: end web build (${_BUILD}: ${_STATUS})." >> /var/log/live - done fi diff --git a/frontends/cgi/live-build-cgi.default b/frontends/cgi/live-build-cgi.default index 838e43109..c7e26bc5f 100644 --- a/frontends/cgi/live-build-cgi.default +++ b/frontends/cgi/live-build-cgi.default @@ -6,6 +6,8 @@ _MODE="debian" _DEBUG="false" +_INSTANCES="1" + _DESTDIR="/srv/debian-live/build/www" _TEMPLATES="/usr/share/live/build/templates/cgi/${_MODE}" _TEMPDIR="/srv/debian-live/build/tmp" |