[Swift-commit] r7260 - trunk/bin
davidk at ci.uchicago.edu
davidk at ci.uchicago.edu
Thu Oct 31 17:23:35 CDT 2013
Author: davidk
Date: 2013-10-31 17:23:35 -0500 (Thu, 31 Oct 2013)
New Revision: 7260
Modified:
trunk/bin/swift-service
Log:
Usage
Modified: trunk/bin/swift-service
===================================================================
--- trunk/bin/swift-service 2013-10-31 22:17:52 UTC (rev 7259)
+++ trunk/bin/swift-service 2013-10-31 22:23:35 UTC (rev 7260)
@@ -16,6 +16,12 @@
exit 1
}
+# Print usage
+usage()
+{
+ crash "$( basename $0 ) [ -start | -stop | -status | -xml ] [ -name servicename ]"
+}
+
# Wait for a file to be created, up to given amount of time
wait_for_file()
{
@@ -245,6 +251,9 @@
if [ -n "$NAME" ]; then
services=$SERVICE_DIR/$NAME
+ if [ ! -d "$services" ]; then
+ crash "Service $NAME does not exist"
+ fi
else
services=$( get_services )
fi
@@ -306,12 +315,12 @@
-status) STATUS=1; shift;;
-name) NAME=$2; shift 2;;
-xml) XML=1; shift;;
- *) echo "Do not recognize command line option: $1" 1>&2; exit 1;;
+ *) echo "Do not recognize command line option: $1" 1>&2; usage;;
esac
done
if [ $(($START+$STOP+$STATUS+$XML)) != 1 ]; then
- crash "Usage fail"
+ usage
fi
# Wait until finished processing command line arguments before starting or stopping the service
More information about the Swift-commit
mailing list