Skip to content

Instantly share code, notes, and snippets.

@yanokwa
Created February 15, 2016 08:01
Show Gist options
  • Save yanokwa/07fa5ad02368f49b98e8 to your computer and use it in GitHub Desktop.
Save yanokwa/07fa5ad02368f49b98e8 to your computer and use it in GitHub Desktop.
#!/bin/bash
# @nightly /bin/bash /root/ODK/export_submissions.sh
set -e
JAVA_BIN="/usr/bin/java"
BRIEFCASE_JAR="/root/ODK/briefcase.jar"
AGGREGATE_URL="https://myserver.appspot.com"
ODK_USERNAME="myusername"
ODK_PASSWORD="mypassword"
STORAGE_DIR="/root/ODK"
EXPORT_DIR="/root/Dropbox/myserver.appspot.com"
FORM_IDS=("form_1" "my_form" "test_form" "training_form")
for FORM_ID in "${FORM_IDS[@]}"; do
echo "Downloading $FORM..."
$JAVA_BIN -jar $BRIEFCASE_JAR --form_id "$FORM_ID" --storage_directory $STORAGE_DIR --aggregate_url $AGGREGATE_URL --odk_username $ODK_USERNAME --odk_password $ODK_PASSWORD;
echo "Exporting $FORM..."
$JAVA_BIN -jar $BRIEFCASE_JAR--form_id "$FORM_ID" --storage_directory $STORAGE_DIR --export_directory $EXPORT_DIR --export_filename "$FORM_ID.csv" --exclude_media_export --overwrite_csv_export;
done
rm -rf $EXPORT_DIR/media;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment