filter-media.sh

Date HTML Created

03 Mar 2008

#!/bin/sh # Setup the environment JAVA_HOME=/opt/jdk1.5.0_10 PATH=$JAVA_HOME/bin:/opt/ant/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin export PATH JAVA_HOME dbname="dspace_ir" username="read_only" hostname="strip3.oit.umn.edu" # Determine if we have Postgres client installed which psql > /dev/null if [ $? -ne 0 ] then echo echo "psql not found in your PATH, please add to your PATH and re-run sc ript" echo exit 1 fi print_usage() { echo 1>&2 "Usage: $0 [-d dbname] [-u username]" exit 1; } while getopts d:hu: o do case "$o" in d) dbname="$OPTARG";; h) print_usage;; n) hostname="$OPTARG";; u) username="$OPTARG";; [?]) print_usage;; esac done echo_cmd="echo SELECT handle FROM handle WHERE resource_type_id=3;" psql_cmd="psql -t -U $username -h $hostname $dbname" BINDIR=`dirname $0` for handle in `$echo_cmd | $psql_cmd` do $BINDIR/filter-media -i $handle done $BINDIR/index-all