onos-run-karaf
883 Bytes
#!/bin/bash
# -----------------------------------------------------------------------------
# Runs ONOS from distributable onos.tar.gz
# -----------------------------------------------------------------------------
ONOS_TAR=
cd /tmp
# Kill any running instances
[ -f /tmp/onos.pid ] && kill -9 $(cat /tmp/onos.pid) &>/dev/null
set -e
# Blitz previously unrolled onos- directory
rm -fr onos-*
# Unroll new image from the specified tar file
[ -f $ONOS_TAR ] && tar zxf $ONOS_TAR
# Change into the ONOS home directory
cd onos-*
export ONOS_HOME=$PWD
# FIXME: for now we're running using the karaf client; later use raw SSH
unset ONOS_USE_SSH
# Start ONOS as a server, but include any specified options
./bin/onos-service server "$@" &>onos.log &
echo "$!" > /tmp/onos.pid
# Hang-on a bit and then start tailing the ONOS log output
sleep 1
tail -f ./apache*/data/log/karaf.log