87 lines
2.2 KiB
Bash
87 lines
2.2 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
# Simple front end
|
||
|
|
# robot.sh com.sequencelogic.robot.{MainClass} --user=nikki
|
||
|
|
# e.g.
|
||
|
|
# ./robot.sh [--log pattern] com.sequencelogic.robot.Nikki --user=nikki
|
||
|
|
# if --log pattern omitted defaults to --log='(^[\[](CONSOLE|VERBOSE|WARN|ERROR|JAVA|LAUNCHER))'
|
||
|
|
|
||
|
|
#DEFARGS="--no-console"
|
||
|
|
DEFARGS=""
|
||
|
|
|
||
|
|
#echo $1 - $@
|
||
|
|
echo ${1+"$@"}
|
||
|
|
|
||
|
|
LOGPAT='(^[\[](CONSOLE|VERBOSE|WARN|ERROR|JAVA|LAUNCHER))'
|
||
|
|
if [ "$1" = '--log' ]; then
|
||
|
|
shift
|
||
|
|
LOGPAT="$1"
|
||
|
|
shift
|
||
|
|
fi
|
||
|
|
|
||
|
|
LOGPAT="VERBOSE"
|
||
|
|
MainClass=$1
|
||
|
|
shift
|
||
|
|
|
||
|
|
echo "SEQUENCELOGICHOME is set to ${SEQUENCELOGICHOME}"
|
||
|
|
export PATH=${SEQUENCELOGICHOME}/bin:${PATH}
|
||
|
|
echo "Using PATH ${PATH}"
|
||
|
|
|
||
|
|
# if absolute path of this script is in the SEQUENCELOGICHOME/bin directory, look for libionu and jar files there
|
||
|
|
# Need eye and nikki one jar
|
||
|
|
|
||
|
|
|
||
|
|
echo "Using libcrypto from: ${CRYPTO_DIR}"
|
||
|
|
echo "Using libeye from: ${EYE_DIR}"
|
||
|
|
echo "Using K2Client from: ${K2C_DIR}"
|
||
|
|
echo "Using cppcore from: ${CPP_DIR}"
|
||
|
|
echo "Using JAR from: ${JAR}"
|
||
|
|
echo "Using LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
|
||
|
|
echo "Using java_libary_path: ${java_library_path}"
|
||
|
|
|
||
|
|
umask 002
|
||
|
|
|
||
|
|
# run it
|
||
|
|
# eat ugly warnings that mean nothing from one-jar
|
||
|
|
ram="1024m"
|
||
|
|
stack="256m"
|
||
|
|
if [ "${MainClass}" = "com.sequencelogic.robot.workflow.IngestBot" ]; then
|
||
|
|
stack="512m"
|
||
|
|
ram="2048m"
|
||
|
|
fi
|
||
|
|
if [ "${MainClass}" = "com.sequencelogic.robot.workflow.OCRBot" ]; then
|
||
|
|
stack="512m"
|
||
|
|
ram="4096m"
|
||
|
|
fi
|
||
|
|
if [ "${MainClass}" = "com.sequencelogic.robot.workflow.ClassificationBot" ]; then
|
||
|
|
stack="512m"
|
||
|
|
ram="2048m"
|
||
|
|
fi
|
||
|
|
if [ "${MainClass}" = "com.sequencelogic.robot.workflow.ClassifyCompareBot" ]; then
|
||
|
|
stack="512m"
|
||
|
|
ram="2048m"
|
||
|
|
fi
|
||
|
|
if [ "${MainClass}" = "com.sequencelogic.robot.workflow.ClassifyWalkerBot" ]; then
|
||
|
|
stack="512m"
|
||
|
|
ram="2048m"
|
||
|
|
fi
|
||
|
|
if [ "${MainClass}" = "com.sequencelogic.robot.workflow.ClassifyCompareWalkerBot" ]; then
|
||
|
|
stack="512m"
|
||
|
|
ram="2048m"
|
||
|
|
fi
|
||
|
|
|
||
|
|
# trap ctrl-c and call ctrl_c()
|
||
|
|
trap ctrl_c INT
|
||
|
|
|
||
|
|
function ctrl_c() {
|
||
|
|
echo "** Trapped CTRL-C"
|
||
|
|
}
|
||
|
|
|
||
|
|
# go
|
||
|
|
java -Xms${stack} -Xmx${ram} -DALLOW_ALL_HOSTNAME_VERIFIER=true -Djava.library.path=${java_library_path} -Done-jar.main.class=${MainClass} -jar ${JAR} ${DEFARGS} ${1+"$@"} 2>&1 | awk "
|
||
|
|
/${LOGPAT}/ {print \$0}
|
||
|
|
/^usage/{y=1;}y"
|
||
|
|
#| egrep "${LOGPAT}"
|
||
|
|
exitStatus=${PIPESTATUS[0]}
|
||
|
|
echo "Exit sl_bots.sh with status: ${exitStatus}"
|
||
|
|
exit ${exitStatus}
|