Jonathan Hart | d956f6f | 2013-02-01 14:41:17 -0800 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Set paths |
| 4 | FL_HOME=`dirname $0` |
| 5 | FL_JAR="${FL_HOME}/target/floodlight.jar" |
| 6 | FL_LOGBACK="${FL_HOME}/logback.xml" |
| 7 | TITAN_CONFIG="/tmp/cassandra.titan" |
| 8 | CASSANDRA_CONFIG="/home/`whoami`/apache-cassandra-1.1.4/conf/cassandra.yaml" |
| 9 | |
| 10 | # Set JVM options |
| 11 | JVM_OPTS="" |
| 12 | #JVM_OPTS="$JVM_OPTS -server -d64" |
| 13 | #JVM_OPTS="$JVM_OPTS -Xmx2g -Xms2g -Xmn800m" |
| 14 | #JVM_OPTS="$JVM_OPTS -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods" |
| 15 | #JVM_OPTS="$JVM_OPTS -XX:MaxInlineSize=8192 -XX:FreqInlineSize=8192" |
| 16 | #JVM_OPTS="$JVM_OPTS -XX:CompileThreshold=1500 -XX:PreBlockSpin=8" |
| 17 | #JVM_OPTS="$JVM_OPTS -Dpython.security.respectJavaAccessibility=false" |
| 18 | |
| 19 | # Set classpath to include titan libs |
| 20 | #CLASSPATH=`echo ${FL_HOME}/lib/*.jar ${FL_HOME}/lib/titan/*.jar | sed 's/ /:/g'` |
| 21 | CLASSPATH="${FL_HOME}/lib/*.jar:${FL_HOME}/lib/titan/*.jar" |
| 22 | |
| 23 | CASSANDRA_OPTS="-Dcom.sun.management.jmxremote.port=7199" |
| 24 | CASSANDRA_OPTS="$CASSANDRA_OPTS -Dcom.sun.management.jmxremote.ssl=false" |
| 25 | CASSANDRA_OPTS="$CASSANDRA_OPTS -Dcom.sun.management.jmxremote.authenticate=false" |
| 26 | |
| 27 | # Create a logback file if required |
| 28 | cat <<EOF_LOGBACK >${FL_LOGBACK} |
| 29 | <configuration scan="true" debug="true"> |
| 30 | <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
| 31 | <encoder> |
| 32 | <pattern>%level [%logger:%thread] %msg%n</pattern> |
| 33 | </encoder> |
| 34 | </appender> |
| 35 | |
| 36 | <appender name="FILE" class="ch.qos.logback.core.FileAppender"> |
| 37 | <file>onos.log</file> |
| 38 | <encoder> |
| 39 | <pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern> |
| 40 | </encoder> |
| 41 | </appender> |
| 42 | |
| 43 | <logger name="org" level="WARN"/> |
| 44 | <logger name="LogService" level="WARN"/> <!-- Restlet access logging --> |
| 45 | <logger name="net.floodlightcontroller.logging" level="WARN"/> |
| 46 | |
| 47 | <root level="DEBUG"> |
| 48 | <appender-ref ref="STDOUT" /> |
| 49 | <appender-ref ref="FILE" /> |
| 50 | </root> |
| 51 | </configuration> |
| 52 | EOF_LOGBACK |
| 53 | |
| 54 | cat <<EOF_TITAN >${TITAN_CONFIG} |
| 55 | storage.backend=embeddedcassandra |
| 56 | storage.hostname=127.0.0.1 |
| 57 | storage.keyspace=onos |
| 58 | storage.cassandra-config-dir=file://${CASSANDRA_CONFIG} |
| 59 | EOF_TITAN |
| 60 | |
| 61 | # Clear logs |
| 62 | rm onos.log |
| 63 | |
| 64 | # Run floodlight |
| 65 | echo "Starting ONOS controller ..." |
| 66 | echo |
| 67 | #java ${JVM_OPTS} -Dlogback.configurationFile=${FL_LOGBACK} -Xbootclasspath/a:$CLASSPATH -jar ${FL_JAR} -cf ./onos.properties |
| 68 | java ${JVM_OPTS} ${CASSANDRA_OPTS} -Dlogback.configurationFile=${FL_LOGBACK} -cp ${CLASSPATH} -jar ${FL_JAR} |