[Swift-commit] r5162 - branches/release-0.93/bin

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Sat Sep 24 08:49:51 CDT 2011


Author: davidk
Date: 2011-09-24 08:49:51 -0500 (Sat, 24 Sep 2011)
New Revision: 5162

Modified:
   branches/release-0.93/bin/start-coaster-service
   branches/release-0.93/bin/stop-coaster-service
Log:
Use coaster-service.conf files from $HOME/.swift


Modified: branches/release-0.93/bin/start-coaster-service
===================================================================
--- branches/release-0.93/bin/start-coaster-service	2011-09-23 23:54:39 UTC (rev 5161)
+++ branches/release-0.93/bin/start-coaster-service	2011-09-24 13:49:51 UTC (rev 5162)
@@ -35,7 +35,7 @@
    for MACHINE in $WORKER_HOSTS
    do
       # Enable ssh tunneling if needed
-      if [ $SSH_TUNNELING == "yes" ]; then
+      if [ "$SSH_TUNNELING" == "yes" ]; then
          ssh -R *:$PORT:localhost:$PORT $WORKER_USERNAME@$MACHINE sleep 999 &
          echo $! >> $PID_FILE
       fi
@@ -58,6 +58,12 @@
    fi
    for MACHINE in $WORKER_HOSTS
    do
+      # Enable ssh tunneling if needed
+      if [ "$SSH_TUNNELING" == "yes" ]; then
+         ssh -R *:$PORT:localhost:$PORT $WORKER_USERNAME@$MACHINE sleep 999 &
+         echo $! >> $PID_FILE
+      fi
+
       scp $SWIFT_BIN/$WORKER $MACHINE:$WORKER_WORK > /dev/null 2>&1
       echo Starting worker on $MACHINE
       ssh $MACHINE $WORKER_WORK/$WORKER $EXECUTION_URL $MACHINE $LOG_DIR &
@@ -105,13 +111,21 @@
   return 0
 }
 
-PID_FILE=".coaster-service-pids"
+if [ ! -d "$HOME/.swift" ]; then
+   mkdir -p "$HOME/.swift" || crash "Unable to create $HOME/.swift"
+fi
+
+PID_FILE="$HOME/.swift/.coaster-service-pids"
 RUN_DIR=`pwd`
-pushd $(dirname $(readlink -f $0)) > /dev/null 2>&1
 
 # Import settings
-CONFIG_FILE="../etc/coaster-service.conf"
-if [ -f "$CONFIG_FILE" ]; then
+if [ -f "$HOME/.swift/coaster-service.conf" ]; then
+   CONFIG_FILE="$HOME/.swift/coaster-service.conf"
+elif [ -f "$(dirname $(readlink -f $0))/../etc/coaster-service.conf" ]; then
+   CONFIG_FILE="$(dirname $(readlink -f $0))/../etc/coaster-service.conf"
+fi
+
+if [ -n "$CONFIG_FILE" ]; then
    source "$CONFIG_FILE"
 else
    crash "Cannot find coaster-service.conf!"
@@ -231,7 +245,7 @@
 gensites persistent-coasters -p $CONFIG_FILE > $RUN_DIR/sites.xml 
 
 # Generate config file
-if [ $SHARED_FILESYSTEM == "no" ]; then
+if [ "$SHARED_FILESYSTEM" == "no" ]; then
 echo Generating config file
 cat > $RUN_DIR/cf << EOF
 use.provider.staging=true

Modified: branches/release-0.93/bin/stop-coaster-service
===================================================================
--- branches/release-0.93/bin/stop-coaster-service	2011-09-23 23:54:39 UTC (rev 5161)
+++ branches/release-0.93/bin/stop-coaster-service	2011-09-24 13:49:51 UTC (rev 5162)
@@ -1,10 +1,5 @@
 #!/bin/bash
 
-# Files relative to location of this script
-PID_FILE=".coaster-service-pids"
-SWIFTVM_INSTANCES=".swiftvm_instances"
-CONFIG_FILE="../etc/coaster-service.conf"
-
 # crash: Report a problem and exit
 crash()
 {
@@ -13,8 +8,21 @@
    exit 1
 }
 
-pushd $(dirname $(readlink -f $0)) > /dev/null 2>&1
+# Location of required files
+PID_FILE="$HOME/.swift/.coaster-service-pids"
+SWIFTVM_INSTANCES="$HOME/.swift/.swiftvm_instances"
 
+if [ -f "$HOME/.swift/coaster-service.conf" ]; then
+   CONFIG_FILE="$HOME/.swift/coaster-service.conf"
+elif [ -f "$(dirname $(readlink -f $0))/../etc/coaster-service.conf" ]; then
+   CONFIG_FILE="$(dirname $(readlink -f $0))/../etc/coaster-service.conf"
+fi
+
+if [ -z "$CONFIG_FILE" ]; then
+   crash "Unable to find coaster-service.conf!"
+fi
+
+
 # Read config file to determine worker mode
 if [ -f "$CONFIG_FILE" ]; then
    source "$CONFIG_FILE"




More information about the Swift-commit mailing list