blob: b8caab683de99faf78ad217fdb873cc73404a32a [file] [log] [blame]
description "Open Network Operating System"
author "Open Networking Foundation"
# onos.conf: ONOS service configuration for upstart-based systems
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
console output
kill timeout 60
respawn
env LANG=en_US.UTF-8
pre-start script
[ -f /opt/onos/options ] && . /opt/onos/options
ONOS_USER=${ONOS_USER:-root}
ONOS_GROUP=${ONOS_GROUP:-$ONOS_USER}
# Fix permissions and symlinks
mkdir -p /opt/onos/var 2>/dev/null && chown $ONOS_USER:$ONOS_GROUP /opt/onos/var
mkdir -p /opt/onos/config 2>/dev/null && chown $ONOS_USER:$ONOS_GROUP /opt/onos/config
mkdir -p /opt/onos/apps 2>/dev/null && chown -R $ONOS_USER:$ONOS_GROUP /opt/onos/apps
[ ! -h $ONOS_HOME/karaf ] && ln -s /opt/onos/apache-karaf* $ONOS_HOME/karaf || :
[ ! -h $ONOS_HOME/log ] && ln -s $ONOS_HOME/karaf/data/log $ONOS_HOME/log || :
end script
pre-stop script
/opt/onos/bin/onos halt 1>>/opt/onos/var/stdout.log 2>>/opt/onos/var/stderr.log
sleep 1
end script
script
[ -f /opt/onos/options ] && . /opt/onos/options
start-stop-daemon --signal INT --start --chuid ${ONOS_USER:-root} \
--exec /opt/onos/bin/onos-service -- ${ONOS_OPTS:-server} \
>/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log
end script