From: Chris Sharp Date: Fri, 31 Jul 2015 12:49:29 +0000 (-0400) Subject: adding script to copy reports templates from one EG server to another X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=73bf1207ca7807633b462cea28225ccd0a5563f1;p=contrib%2Fpines.git adding script to copy reports templates from one EG server to another --- 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 +