--- tinderd.orig 2010-01-04 20:56:05.000000000 +0100 +++ tinderd 2010-01-05 20:13:58.000000000 +0100 @@ -28,7 +28,22 @@ do trap "" 1 - ENTRY=$(${pb}/scripts/tc listBuildPortsQueue -s ENQUEUED -r | head -1) + ENTRY="" + + if mkdir /tmp/tinderdlock >/dev/null 2>&1; then + ${pb}/scripts/tc listBuildPortsQueue -s ENQUEUED -r > /tmp/tinderd.$$ + while read line; do + BUILD=$(echo ${line} | cut -d: -f3) + if [ ! -f $pb/builds/$BUILD/tinderdlock -a ! -f $pb/builds/$BUILD/lock ]; then + touch $pb/builds/$BUILD/tinderdlock + ENTRY=$line + break + fi + done < /tmp/tinderd.$$ + rm /tmp/tinderd.$$ + rmdir /tmp/tinderdlock + fi + ID=$(echo ${ENTRY} | cut -d: -f1) USER=$(echo ${ENTRY} | cut -d: -f2) BUILD=$(echo ${ENTRY} | cut -d: -f3) @@ -36,12 +51,14 @@ MAIL=$(echo ${ENTRY} | cut -d: -f5) if [ -n "${BUILD}" -a -n "${PORT}" -a -n "${ID}" ] ; then + mount -t tmpfs tmpfs ${pb}/${BUILD} tinderEcho "INFO: Going to build ${PORT} on ${BUILD}" ${pb}/scripts/tc updateBuildPortsQueueEntryStatus \ -i "${ID}" -s PROCESSING if ! ${pb}/scripts/tc addPort -b "${BUILD}" -d "${PORT}"; then ${pb}/scripts/tc updateBuildPortsQueueEntryStatus \ -i "${ID}" -s FAIL + umount ${pb}/${BUILD} continue fi @@ -64,7 +81,9 @@ fi ${pb}/scripts/tc reorgBuildPortsQueue + umount ${pb}/${BUILD} + rm $pb/builds/$BUILD/tinderdlock else tinderEcho "INFO: Nothing to do. Sleeping ${TINDERD_SLEEPTIME} seconds." trap main_loop 1 --- etc/rc.d/tinderd.orig 2010-01-04 20:56:05.000000000 +0100 +++ etc/rc.d/tinderd 2010-01-05 20:11:17.000000000 +0100 @@ -24,6 +24,7 @@ : ${tinderd_directory="/space/scripts"} : ${tinderd_flags=""} : ${tinderd_debug="NO"} +: ${tinderd_instances="1"} # path to your executable, might be libexec, bin, sbin, ... command="${tinderd_directory}/tinderd" @@ -39,4 +40,13 @@ command_args=">/dev/null &" fi +start_cmd="${name}_start" + +tinderd_start() +{ + for i in `jot - 1 ${tinderd_instances}`; do + ${command} ${tinderd_flags} >/dev/null 2>&1 & + done +} + run_rc_command "$1"