Multiple tinderd instances
Tim Bishop
tim-lists at bishnet.net
Fri Aug 1 21:48:43 EDT 2008
On Sat, Aug 02, 2008 at 02:44:52AM +0100, Tim Bishop wrote:
> The attached patch ...
... got lost. Here it is inline:
diff -ruN /usr/local/tinderbox/scripts/etc/rc.d/tinderd.sh scripts/etc/rc.d/tinderd.sh
--- /usr/local/tinderbox/scripts/etc/rc.d/tinderd.sh 2008-01-17 12:31:39.000000000 +0000
+++ scripts/etc/rc.d/tinderd.sh 2008-01-17 12:33:18.000000000 +0000
@@ -24,6 +24,7 @@
: ${tinderd_enable="NO"}
: ${tinderd_directory="/space/scripts"}
: ${tinderd_flags=""}
+: ${tinderd_instances="1"}
# path to your executable, might be libxec, bin, sbin, ...
command="${tinderd_directory}/tinderd"
@@ -34,4 +35,13 @@
# extra required arguments
command_args=">/dev/null &"
+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"
diff -ruN /usr/local/tinderbox/scripts/tinderd scripts/tinderd
--- /usr/local/tinderbox/scripts/tinderd 2008-01-17 12:31:39.000000000 +0000
+++ scripts/tinderd 2008-01-17 12:33:18.000000000 +0000
@@ -15,7 +15,22 @@
main_loop() {
while true ; 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)
@@ -37,6 +52,8 @@
fi
${pb}/scripts/tc reorgBuildPortsQueue
+
+ rm $pb/builds/$BUILD/tinderdlock
else
tinder_echo "INFO: Nothing to do. Sleeping ${TINDERD_SLEEPTIME} seconds."
trap main_loop 1
More information about the tinderbox-list
mailing list