[Swift-commit] r5952 - trunk/bin

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Thu Sep 27 15:04:54 CDT 2012


Author: davidk
Date: 2012-09-27 15:04:54 -0500 (Thu, 27 Sep 2012)
New Revision: 5952

Modified:
   trunk/bin/start-coaster-service
   trunk/bin/stop-coaster-service
Log:
Fix to be able to gracefully stop runs when multiple start-coaster-service processes are running


Modified: trunk/bin/start-coaster-service
===================================================================
--- trunk/bin/start-coaster-service	2012-09-26 19:36:41 UTC (rev 5951)
+++ trunk/bin/start-coaster-service	2012-09-27 20:04:54 UTC (rev 5952)
@@ -364,7 +364,7 @@
 fi
 
 PID_FILE="$HOME/.swift/.coaster-service-pids"
-RUN_DIR=`pwd`
+RUN_DIR=$PWD
 
 # Import settings
 if [ -f "$CMDLN_CONF" ]; then
@@ -378,7 +378,6 @@
 else
    crash "Cannot find coaster-service.conf!"
 fi
-cp $CONFIG_FILE $HOME/.swift/.config
 
 echo "Start-coaster-service..."
 echo "Configuration: $CONFIG_FILE"

Modified: trunk/bin/stop-coaster-service
===================================================================
--- trunk/bin/stop-coaster-service	2012-09-26 19:36:41 UTC (rev 5951)
+++ trunk/bin/stop-coaster-service	2012-09-27 20:04:54 UTC (rev 5952)
@@ -11,12 +11,34 @@
 # Location of required files
 PID_FILE="$HOME/.swift/.coaster-service-pids"
 SWIFTVM_INSTANCES="$HOME/.swift/.swiftvm_instances"
+RUN_DIR=$PWD
 
+# Command line options
+while [ $# -gt 0 ]; do
+   case $1 in
+      -conf) CMDLN_CONF=$2; shift 2;; 
+      *) echo "Do not recognize command line option: $1" 1>&2; exit 1;; 
+   esac
+done
+
 # Import settings
-CONFIG_FILE=$HOME/.swift/.config
+if [ -f "$CMDLN_CONF" ]; then
+   CONFIG_FILE=$CMDLN_CONF
+elif [ -f "$RUN_DIR/coaster-service.conf" ]; then
+   CONFIG_FILE="$RUN_DIR/coaster-service.conf"
+elif [ -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"
+else
+   crash "Cannot find coaster-service.conf!"
+fi
 source "$CONFIG_FILE"
 
+echo "Stop-coaster-service..."
+echo "Configuration: $CONFIG_FILE"
 echo Ending coaster processes..
+
 if [ -f "$PID_FILE" ]; then
    for pid in `cat $PID_FILE`
    do




More information about the Swift-commit mailing list