[Swift-commit] r7378 - in trunk: . bin
davidk at ci.uchicago.edu
davidk at ci.uchicago.edu
Thu Dec 5 11:47:16 CST 2013
Author: davidk
Date: 2013-12-05 11:47:15 -0600 (Thu, 05 Dec 2013)
New Revision: 7378
Added:
trunk/bin/foreachworker
Modified:
trunk/build.xml
Log:
Adding a foreachworker shell script to run a command on each worker connected to a given service
Added: trunk/bin/foreachworker
===================================================================
--- trunk/bin/foreachworker (rev 0)
+++ trunk/bin/foreachworker 2013-12-05 17:47:15 UTC (rev 7378)
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+SERVICE=$1
+COMMAND=$2
+
+# Verify usage
+if [ -z "$SERVICE" ] || [ -z "$COMMAND" ]; then
+ echo "Usage: $0 service_name command"
+ exit 1
+fi
+
+# Verify service is running, and get file containing URL
+URL_FILE="$HOME/.swift/service/$SERVICE/service.url"
+if [ ! -f "$URL_FILE" ]; then
+ echo "Unable to find service $SERVICE"
+ exit 1
+fi
+
+WORKERS=$( coaster-client $( cat $URL_FILE ) list workers | sed 1d | awk '{print $1}' )
+for worker in $WORKERS
+do
+ echo Running command $COMMAND on worker $worker
+ coaster-client $( cat $URL_FILE ) runcmd $worker $COMMAND > ${worker}.command.log 2>&1
+done
Property changes on: trunk/bin/foreachworker
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2013-12-04 19:51:31 UTC (rev 7377)
+++ trunk/build.xml 2013-12-05 17:47:15 UTC (rev 7378)
@@ -86,6 +86,7 @@
<chmod perm="+x">
<fileset dir="${dist.dir}/bin">
<include name="apptimes"/>
+ <include name="foreachworker"/>
<include name="gensites"/>
<include name="prop2scs.pl"/>
<include name="start-coaster-service"/>
More information about the Swift-commit
mailing list