From 73bf1207ca7807633b462cea28225ccd0a5563f1 Mon Sep 17 00:00:00 2001 From: Chris Sharp Date: Fri, 31 Jul 2015 08:49:29 -0400 Subject: [PATCH] adding script to copy reports templates from one EG server to another --- copy_reports_templates.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 copy_reports_templates.sh diff --git a/copy_reports_templates.sh b/copy_reports_templates.sh new file mode 100644 index 0000000..97e50ce --- /dev/null +++ b/copy_reports_templates.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# a script to generate an SQL file containing reports templates that can be +# imported into another Evergreen server + +DB_USER="evergreen" +DB_HOST="localhost" +DB_NAME="evergreen" +OUTFILE="templates_to_import_`date +%F`.sql" + +read -p "Please enter a comma-and-space-separated list of template ids for the reports you're copying (e.g., 12345, 12346, 12347 - No comma necessary if just one template): " TEMPLATES +read -p "Please enter the id for the destination template owner on the destination server: " OWNER +read -p "Please enter the id for the destination template folder on the destination server for the copied templates: " FOLDER + +read -d '' SQL <> $OUTFILE +psql -A -t -U "$DB_USER" -h "$DB_HOST" -c "$SQL" "$DB_NAME" >> "$OUTFILE" +echo "commit;" >> $OUTFILE + -- 2.11.0