[Swift-commit] r7928 - trunk/bin

tga at ci.uchicago.edu tga at ci.uchicago.edu
Tue Jun 24 10:11:06 CDT 2014


Author: tga
Date: 2014-06-24 10:11:06 -0500 (Tue, 24 Jun 2014)
New Revision: 7928

Modified:
   trunk/bin/stop-coaster-service
Log:
Add usage to stop-coaster-service

Modified: trunk/bin/stop-coaster-service
===================================================================
--- trunk/bin/stop-coaster-service	2014-06-24 15:11:01 UTC (rev 7927)
+++ trunk/bin/stop-coaster-service	2014-06-24 15:11:06 UTC (rev 7928)
@@ -8,6 +8,25 @@
    exit 1
 }
 
+# Display usage message
+usage()
+{
+    echo "Usage: $(basename $0) [OPTION]..." >&2
+    echo "Options:" >&2
+    echo "-conf <CONFIG FILE>\
+           Coasters service configuration file (default: coaster-service.conf)" >&2
+}
+
+# Report a problem, then usage, then exit
+usage_crash()
+{
+   MSG=$1
+   echo ${MSG} >&2
+   echo
+   usage
+   exit 1
+}
+
 # Location of required files
 PID_FILE="$HOME/.swift/.coaster-service-pids"
 SWIFTVM_INSTANCES="$HOME/.swift/.swiftvm_instances"
@@ -17,7 +36,7 @@
 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;; 
+      *) echo "Do not recognize command line option: $1" 1>&2; usage; exit 1;; 
    esac
 done
 
@@ -31,7 +50,7 @@
 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!"
+   usage_crash "Cannot find coaster-service.conf!"
 fi
 source "$CONFIG_FILE"
 




More information about the Swift-commit mailing list