From: <bra...@us...> - 2008-05-05 21:34:09
|
Revision: 2262 http://archive-access.svn.sourceforge.net/archive-access/?rev=2262&view=rev Author: bradtofel Date: 2008-05-05 14:34:10 -0700 (Mon, 05 May 2008) Log Message: ----------- INITIAL REV: command line tool for accessing main() in FileLocationDB Added Paths: ----------- trunk/archive-access/projects/wayback/dist/src/scripts/location-db Added: trunk/archive-access/projects/wayback/dist/src/scripts/location-db =================================================================== --- trunk/archive-access/projects/wayback/dist/src/scripts/location-db (rev 0) +++ trunk/archive-access/projects/wayback/dist/src/scripts/location-db 2008-05-05 21:34:10 UTC (rev 2262) @@ -0,0 +1,82 @@ +#!/usr/bin/env sh +## +## This script allows querying and updating of a remote LocationDB from the +## command line, including syncronizing the LocationDB with an entire directory +## of ARCs files +## +## Optional environment variables +## +## JAVA_HOME Point at a JDK install to use. +## +## WAYBACK_HOME Pointer to your wayback install. If not present, we +## make an educated guess based of position relative to this +## script. +## +## JAVA_OPTS Java runtime options. Default setting is '-Xmx256m'. +## + +# Resolve links - $0 may be a softlink +PRG="$0" +while [ -h "$PRG" ]; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '.*/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`/"$link" + fi +done +PRGDIR=`dirname "$PRG"` + +# Set WAYBACK_HOME. +if [ -z "$WAYBACK_HOME" ] +then + WAYBACK_HOME=`cd "$PRGDIR/.." ; pwd` +fi + +# Find JAVA_HOME. +if [ -z "$JAVA_HOME" ] +then + JAVA=`which java` + if [ -z "$JAVA" ] + then + echo "Cannot find JAVA. Please set JAVA_HOME or your PATH." + exit 1 + fi + JAVA_BINDIR=`dirname $JAVA` + JAVA_HOME=$JAVA_BINDIR/.. +fi + +if [ -z "$JAVACMD" ] +then + # It may be defined in env - including flags!! + JAVACMD=$JAVA_HOME/bin/java +fi + +# Ignore previous classpath. Build one that contains heritrix jar and content +# of the lib directory into the variable CP. +for jar in `ls $WAYBACK_HOME/lib/*.jar $WAYBACK_HOME/*.jar 2> /dev/null` +do + CP=${CP}:${jar} +done + +# cygwin path translation +if expr `uname` : 'CYGWIN*' > /dev/null; then + CP=`cygpath -p -w "$CP"` + WAYBACK_HOME=`cygpath -p -w "$WAYBACK_HOME"` +fi + +# Make sure of java opts. +if [ -z "$JAVA_OPTS" ] +then + JAVA_OPTS=" -Xmx256m" +fi + +# Main ArcIndexer class. +if [ -z "$CLASS_MAIN" ] +then + CLASS_MAIN='org.archive.wayback.resourcestore.http.FileLocationDB' +fi + +CLASSPATH=${CP} $JAVACMD ${JAVA_OPTS} $CLASS_MAIN "$@" + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |