Skip to content

Instantly share code, notes, and snippets.

@adriantofan
Created December 20, 2018 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adriantofan/a17e80030e48cc44392755398f3df49a to your computer and use it in GitHub Desktop.
Save adriantofan/a17e80030e48cc44392755398f3df49a to your computer and use it in GitHub Desktop.
how to process bash params
#!/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