blob: ea9657e08704766babc2cd38ebfc6dcd9d111aea [file] [log] [blame]
Thomas Vachuska9edca302014-11-22 17:06:42 -08001description "Open Network Operating System"
tom0eaa97f2014-09-22 16:13:06 -07002author "ON.Lab"
3
4start on (net-device-up
5 and local-filesystems
6 and runlevel [2345])
7stop on runlevel [016]
8
9console output
10kill timeout 60
11respawn
12
13env LANG=en_US.UTF-8
Brian O'Connor6f1c5672015-09-16 17:41:25 -070014
15pre-start script
Brian O'Connor8a0c20e2015-09-16 22:54:24 -070016 [ -f /opt/onos/options ] && . /opt/onos/options
17 ONOS_USER=${ONOS_USER:-root}
18
Brian O'Connor6f1c5672015-09-16 17:41:25 -070019 # Ensure that the environment is initialized
Brian O'Connor8a0c20e2015-09-16 22:54:24 -070020 [ -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'Connor6f1c5672015-09-16 17:41:25 -070022 # TODO make karaf version configurable
23 [ -d /opt/onos ] && [ ! -h /opt/onos/log ] \
Jian Li11599162016-01-15 15:46:16 -080024 && ln -s /opt/onos/apache-karaf-3.0.5/data/log /opt/onos/log || :
Brian O'Connor6f1c5672015-09-16 17:41:25 -070025end script
tom0eaa97f2014-09-22 16:13:06 -070026
tomb41d1ac2014-09-24 01:51:24 -070027pre-stop script
Bob Lantz0b8466b2016-04-15 15:39:51 -070028 /opt/onos/bin/onos halt 1>>/opt/onos/var/stdout.log 2>>/opt/onos/var/stderr.log
Thomas Vachuska74bcd922015-06-02 13:08:57 -070029 sleep 1
tomb41d1ac2014-09-24 01:51:24 -070030end script
31
tom0eaa97f2014-09-22 16:13:06 -070032script
33 [ -f /opt/onos/options ] && . /opt/onos/options
Brian O'Connor6f1c5672015-09-16 17:41:25 -070034 start-stop-daemon --signal INT --start --chuid ${ONOS_USER:-root} \
35 --exec /opt/onos/bin/onos-service -- ${ONOS_OPTS:-server} \
tom0eaa97f2014-09-22 16:13:06 -070036 >/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log
37end script