Created
December 20, 2018 13:46
-
-
Save adriantofan/a17e80030e48cc44392755398f3df49a to your computer and use it in GitHub Desktop.
how to process bash params
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -lt 3 ]; then | |
echo "Usage: ./run_oncloud.sh project-name bucket-name classname [options] " | |
echo "Example: ./run_oncloud.sh cloud-training-demos cloud-training-demos CurrentConditions --bigtable" | |
exit | |
fi | |
PROJECT=$1 | |
shift | |
BUCKET=$1 | |
shift | |
MAIN=com.google.cloud.training.dataanalyst.sandiego.$1 | |
shift | |
echo "Launching $MAIN project=$PROJECT bucket=$BUCKET $*" | |
export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin/:$PATH | |
mvn compile -e exec:java \ | |
-Dexec.mainClass=$MAIN \ | |
-Dexec.args="--project=$PROJECT \ | |
--stagingLocation=gs://$BUCKET/staging/ $* \ | |
--tempLocation=gs://$BUCKET/staging/ \ | |
--runner=DataflowRunner" | |
# If you run into quota problems, add this option the command line above | |
# --maxNumWorkers=2 | |
# In this case, you will not be able to view autoscaling, however. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment