https://github.com/CampagneLaboratory/goby
Tip revision: b4f214eb041594c2ffba2c7bfaba751ce2ff60ed authored by Fabien Campagne on 02 March 2015, 20:29:49 UTC
Update change log.
Update change log.
Tip revision: b4f214e
goby
#!/bin/bash
# This script runs Goby with the specified amount of memory.
# The script will find the Goby jar if it is located in the same directory as this script
# Usage: goby mem-requirement mode-name [param]+
# Where mem-requirement indicates how much memory Goby should be given (e.g., 1g, 500m).
# Mode-name should specify a Goby mode.
# For instance, the following command will display the Goby version number:
# goby 40m version
memory_requirement=$1
shift
other_parameters=$*
WORKING_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [[ $OSTYPE == "cygwin" ]]; then
WORKING_DIR=`cygpath -m "${WORKING_DIR}"`
fi
GOBY_HOME=${WORKING_DIR}
GOBY_JAR=${GOBY_HOME}/goby.jar
LOG4J_PROPS=file://${GOBY_HOME}/config/log4j-sample.properties
if [ "${RJAVA_HOME:-notset}" == "notset" ]; then
echo "Trying to set RJAVA_HOME environment variable"
cat >/tmp/r-cmd.txt <<EOT
system.file("jri",package="rJava")
EOT
tmpWithQuotes=`R --no-save </tmp/r-cmd.txt|grep [1]|tail -1 |awk '{print $2}'`
temp="${tmpWithQuotes%\"}"
temp="${temp#\"}"
echo "$temp"
export RJAVA_HOME=${temp}
rm -f /tmp/r-cmd.txt
echo "RJAVA_HOME=${RJAVA_HOME}"
fi
echo java -ea -Xmx${memory_requirement} -Dlog4j.configuration=${LOG4J_PROPS} -Djava.library.path=${RJAVA_HOME} -jar ${GOBY_JAR} --mode ${other_parameters}
java -ea -Xmx${memory_requirement} -Dlog4j.configuration=${LOG4J_PROPS} -Djava.library.path=${RJAVA_HOME} -jar ${GOBY_JAR} --mode ${other_parameters}