1
|
#!/bin/sh
|
2
|
#
|
3
|
# Shell script for launching Metacat Harvester from unix systems
|
4
|
#
|
5
|
# '$RCSfile: morpho,v $'
|
6
|
# '$Author: leinfelder $'
|
7
|
# '$Date: 2013-07-17 11:59:56 -0700 (Wed, 17 Jul 2013) $'
|
8
|
# '$Revision: 8020 $'
|
9
|
|
10
|
# use java launcher under JAVA_HOME if set, otherwise try search path
|
11
|
if [ -n "$JAVA_HOME" ]; then
|
12
|
if [ ! -d "$JAVA_HOME" ]; then
|
13
|
echo "Error: JAVA_HOME is not a valid directory"
|
14
|
exit 1
|
15
|
fi
|
16
|
JAVA_HOME="$( cd $JAVA_HOME ; pwd -P )"
|
17
|
echo "Using JAVA_HOME=$JAVA_HOME"
|
18
|
JAVA_BIN="$JAVA_HOME/bin/java"
|
19
|
ERR="Your JAVA_HOME does not contain bin/java"
|
20
|
else
|
21
|
JAVA_BIN="$(command -v java)"
|
22
|
echo "No JAVA_HOME variable set"
|
23
|
ERR="JAVA_HOME was not set, and no other java was found on your path"
|
24
|
fi
|
25
|
if [ -f "$JAVA_BIN" ]; then
|
26
|
echo "Attempting to use java launcher $JAVA_BIN"
|
27
|
else
|
28
|
echo "Error: $ERR"
|
29
|
exit 1
|
30
|
fi
|
31
|
echo "----------------------------------"
|
32
|
"$JAVA_BIN" -version || exit 1
|
33
|
echo "----------------------------------"
|
34
|
|
35
|
LIB=$METACAT_HOME/WEB-INF/lib
|
36
|
|
37
|
# generate classpath, with some error checking
|
38
|
CPATH="."
|
39
|
for JAR in $LIB/*.jar; do
|
40
|
[ -f "$JAR" ] || continue
|
41
|
CPATH="$CPATH:$JAR"
|
42
|
done
|
43
|
if [ -z "$CPATH" ]; then
|
44
|
echo "Error: No Morpho JAR files found in $LIB"
|
45
|
exit 1
|
46
|
fi
|
47
|
echo "Using dynamic classpath: $CPATH"
|
48
|
|
49
|
# launch it
|
50
|
"$JAVA_BIN" -cp "$CPATH" edu.ucsb.nceas.metacat.harvesterClient.Harvester $1
|