https://github.com/CampagneLaboratory/goby
Tip revision: d9916a6568a7a8a143847ec74254ebf7f774dc11 authored by Fabien Campagne on 21 June 2016, 02:51:12 UTC
Merge branch 'stable' of bitbucket.org:campagnelaboratory/goby into stable
Merge branch 'stable' of bitbucket.org:campagnelaboratory/goby into stable
Tip revision: d9916a6
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}