Jonathan Hart | fe99038 | 2013-02-06 15:22:32 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | CP=$( echo `dirname $0`/../lib/*.jar `dirname $0`/../lib/titan/*.jar . | sed 's/ /:/g') |
| 4 | |
| 5 | # Find Java |
| 6 | if [ "$JAVA_HOME" = "" ] ; then |
| 7 | JAVA="java -server" |
| 8 | else |
| 9 | JAVA="$JAVA_HOME/bin/java -server" |
| 10 | fi |
| 11 | |
| 12 | # Set Java options |
| 13 | if [ "$JAVA_OPTIONS" = "" ] ; then |
| 14 | JAVA_OPTIONS="-Xms32m -Xmx512m" |
| 15 | fi |
| 16 | |
| 17 | # Launch the application |
| 18 | if [ "$1" = "-e" ]; then |
| 19 | k=$2 |
| 20 | if [ $# -gt 2 ]; then |
| 21 | for (( i=3 ; i < $# + 1 ; i++ )) |
| 22 | do |
| 23 | eval a=\$$i |
| 24 | k="$k \"$a\"" |
| 25 | done |
| 26 | fi |
| 27 | |
| 28 | eval $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.thinkaurelius.titan.tinkerpop.gremlin.ScriptExecutor $k |
| 29 | else |
| 30 | if [ "$1" = "-v" ]; then |
| 31 | $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.tinkerpop.gremlin.Version |
| 32 | else |
| 33 | $JAVA $JAVA_OPTIONS -cp $CP:$CLASSPATH com.thinkaurelius.titan.tinkerpop.gremlin.Console |
| 34 | fi |
| 35 | fi |
| 36 | |
| 37 | # Return the program's exit code |
| 38 | exit $? |