From: Chris Sharp Date: Wed, 6 Jan 2016 13:25:42 +0000 (-0500) Subject: Organizing and adding scripts. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=362db2798135c7a80275fcad2151d20c5bbed9f3;p=contrib%2Fpines.git Organizing and adding scripts. --- diff --git a/bricks/copy_files.sh b/bricks/copy_files.sh new file mode 100755 index 0000000..c199e4c --- /dev/null +++ b/bricks/copy_files.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +FILE="$1" + +for i in {2..6}; + do scp $FILE brick0$i-head:$FILE; +done + diff --git a/get_circ_history.sh b/get_circ_history.sh deleted file mode 100755 index d30155f..0000000 --- a/get_circ_history.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash - -Usage () { -echo -echo "Usage: $0 [-b item barcode] [-l result limit]" -echo -echo "If you don't specify item barcode, you'll be prompted" -echo "to provide one. Result limit defaults to 10." -echo -} - -while getopts i:l:u:h OPTIONS -do case "$OPTIONS" in - i) ITEM_BARCODE="$OPTARG";; # TODO: allow multiple barcodes - l) LIMIT="$OPTARG";; - u) USER_BARCODE="$OPTARG";; - h) Usage; exit 1;; - esac -done - -# Note: it is assumed that you're using .pgpass here -PSQL="/usr/bin/psql" -PSQL_HOST="mydbhost" -PSQL_USER="evergreen" -PSQL_DB="evergreen" - -# if we have no command line arguments, prompt the user -if [ "$*" = '' ]; then - echo "We need an item barcode and/or a user barcode." - read -p "Please enter the item barcode (Enter for none): " ITEM_BARCODE - read -p "Please enter the user barcode (Enter for none): " USER_BARCODE -fi - -# if we have a user barcode but no item barcode... -if [ -z "$ITEM_BARCODE" ] && [ ! -z "$USER_BARCODE" ]; then - SQL_WHERE="WHERE u_card.barcode = '$USER_BARCODE'" -# if we have an item barcode but no user barcode... -elif [ ! -z "$ITEM_BARCODE" ] && [ -z "$USER_BARCODE" ]; then - SQL_WHERE="WHERE cp.barcode = '$ITEM_BARCODE'" -# both are empty, exit the script -elif [ -z "$ITEM_BARCODE" ] && [ -z "$USER_BARCODE" ]; then - echo "We need either an item or user barcode to run this script. Exiting..." - exit 1; -# if we've gotten this far, we have both -else - SQL_WHERE="WHERE u_card.barcode = '$USER_BARCODE' AND cp.barcode = '$ITEM_BARCODE'" -fi - -if [ -z "$LIMIT" ]; then - LIMIT=10 -fi - -read -d '' SQL <" -exit 1 -} - -GROUP_NAME="$1" -PG_USER="evergreen" -PSQL="/usr/bin/psql" -PG_DB="evergreen" - - -if [ -z $GROUP_NAME ]; then - Usage -fi -read -d '' SQL <" +exit 1 +} + +GROUP_NAME="$1" +PG_USER="evergreen" +PSQL="/usr/bin/psql" +PG_DB="evergreen" + + +if [ -z $GROUP_NAME ]; then + Usage +fi +read -d '' SQL <