Thomas Vachuska | 9edca30 | 2014-11-22 17:06:42 -0800 | [diff] [blame] | 1 | description "Open Network Operating System" |
tom | 0eaa97f | 2014-09-22 16:13:06 -0700 | [diff] [blame] | 2 | author "ON.Lab" |
| 3 | |
| 4 | start on (net-device-up |
| 5 | and local-filesystems |
| 6 | and runlevel [2345]) |
| 7 | stop on runlevel [016] |
| 8 | |
| 9 | console output |
| 10 | kill timeout 60 |
| 11 | respawn |
| 12 | |
| 13 | env LANG=en_US.UTF-8 |
Brian O'Connor | 6f1c567 | 2015-09-16 17:41:25 -0700 | [diff] [blame] | 14 | |
| 15 | pre-start script |
Brian O'Connor | 8a0c20e | 2015-09-16 22:54:24 -0700 | [diff] [blame] | 16 | [ -f /opt/onos/options ] && . /opt/onos/options |
| 17 | ONOS_USER=${ONOS_USER:-root} |
| 18 | |
Brian O'Connor | 6f1c567 | 2015-09-16 17:41:25 -0700 | [diff] [blame] | 19 | # Ensure that the environment is initialized |
Brian O'Connor | 8a0c20e | 2015-09-16 22:54:24 -0700 | [diff] [blame] | 20 | [ -d /opt/onos ] && mkdir /opt/onos/var 2>/dev/null && chown $ONOS_USER.$ONOS_USER /opt/onos/var |
| 21 | [ -d /opt/onos ] && mkdir /opt/onos/config 2>/dev/null && chown $ONOS_USER.$ONOS_USER /opt/onos/config |
Brian O'Connor | 6f1c567 | 2015-09-16 17:41:25 -0700 | [diff] [blame] | 22 | # TODO make karaf version configurable |
| 23 | [ -d /opt/onos ] && [ ! -h /opt/onos/log ] \ |
Jian Li | 1159916 | 2016-01-15 15:46:16 -0800 | [diff] [blame] | 24 | && ln -s /opt/onos/apache-karaf-3.0.5/data/log /opt/onos/log || : |
Brian O'Connor | 6f1c567 | 2015-09-16 17:41:25 -0700 | [diff] [blame] | 25 | end script |
tom | 0eaa97f | 2014-09-22 16:13:06 -0700 | [diff] [blame] | 26 | |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 27 | pre-stop script |
Bob Lantz | 0b8466b | 2016-04-15 15:39:51 -0700 | [diff] [blame] | 28 | /opt/onos/bin/onos halt 1>>/opt/onos/var/stdout.log 2>>/opt/onos/var/stderr.log |
Thomas Vachuska | 74bcd92 | 2015-06-02 13:08:57 -0700 | [diff] [blame] | 29 | sleep 1 |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 30 | end script |
| 31 | |
tom | 0eaa97f | 2014-09-22 16:13:06 -0700 | [diff] [blame] | 32 | script |
| 33 | [ -f /opt/onos/options ] && . /opt/onos/options |
Brian O'Connor | 6f1c567 | 2015-09-16 17:41:25 -0700 | [diff] [blame] | 34 | start-stop-daemon --signal INT --start --chuid ${ONOS_USER:-root} \ |
| 35 | --exec /opt/onos/bin/onos-service -- ${ONOS_OPTS:-server} \ |
tom | 0eaa97f | 2014-09-22 16:13:06 -0700 | [diff] [blame] | 36 | >/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log |
| 37 | end script |