Jonathan Hart | d956f6f | 2013-02-01 14:41:17 -0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Set paths |
Masayoshi Kobayashi | 2022487 | 2013-06-20 17:00:17 -0700 | [diff] [blame] | 4 | ONOS_HOME=`dirname $0` |
| 5 | ONOS_JAR="${ONOS_HOME}/target/floodlight.jar" |
| 6 | ONOS_LOGBACK="${ONOS_HOME}/logback.xml" |
Jonathan Hart | d956f6f | 2013-02-01 14:41:17 -0800 | [diff] [blame] | 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 |
Masayoshi Kobayashi | 2022487 | 2013-06-20 17:00:17 -0700 | [diff] [blame] | 20 | #CLASSPATH=`echo ${ONOS_HOME}/lib/*.jar ${ONOS_HOME}/lib/titan/*.jar | sed 's/ /:/g'` |
| 21 | CLASSPATH="${ONOS_HOME}/lib/*.jar:${ONOS_HOME}/lib/titan/*.jar" |
Jonathan Hart | d956f6f | 2013-02-01 14:41:17 -0800 | [diff] [blame] | 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 |
Masayoshi Kobayashi | 2022487 | 2013-06-20 17:00:17 -0700 | [diff] [blame] | 28 | cat <<EOF_LOGBACK >${ONOS_LOGBACK} |
Jonathan Hart | d956f6f | 2013-02-01 14:41:17 -0800 | [diff] [blame] | 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 |
Masayoshi Kobayashi | 2022487 | 2013-06-20 17:00:17 -0700 | [diff] [blame] | 67 | #java ${JVM_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -Xbootclasspath/a:$CLASSPATH -jar ${ONOS_JAR} -cf ./onos.properties |
| 68 | java ${JVM_OPTS} ${CASSANDRA_OPTS} -Dlogback.configurationFile=${ONOS_LOGBACK} -jar ${ONOS_JAR} |