| description "Open Network Operating System" |
| author "Open Networking Foundation" |
| # onos.conf: ONOS service configuration for upstart-based systems |
| [ -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 || : |
| /opt/onos/bin/onos halt 1>>/opt/onos/var/stdout.log 2>>/opt/onos/var/stderr.log |
| [ -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 |