| description "Open Network Operating System" |
| [ -f /opt/onos/options ] && . /opt/onos/options |
| ONOS_USER=${ONOS_USER:-root} |
| # Ensure that the environment is initialized |
| [ -d /opt/onos ] && mkdir /opt/onos/var 2>/dev/null && chown $ONOS_USER.$ONOS_USER /opt/onos/var |
| [ -d /opt/onos ] && mkdir /opt/onos/config 2>/dev/null && chown $ONOS_USER.$ONOS_USER /opt/onos/config |
| # TODO make karaf version configurable |
| [ -d /opt/onos ] && [ ! -h /opt/onos/log ] \ |
| && ln -s /opt/onos/apache-karaf-3.0.5/data/log /opt/onos/log || : |
| /opt/onos/bin/onos halt 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 |