blob: b8caab683de99faf78ad217fdb873cc73404a32a [file] [log] [blame]
Thomas Vachuska9edca302014-11-22 17:06:42 -08001description "Open Network Operating System"
Yuta HIGUCHIf87603c2017-09-01 09:46:19 -07002author "Open Networking Foundation"
tom0eaa97f2014-09-22 16:13:06 -07003
Bob Lantzd22c9912016-12-15 14:26:18 -08004# onos.conf: ONOS service configuration for upstart-based systems
5
tom0eaa97f2014-09-22 16:13:06 -07006start on (net-device-up
7 and local-filesystems
8 and runlevel [2345])
9stop on runlevel [016]
10
11console output
12kill timeout 60
13respawn
14
15env LANG=en_US.UTF-8
Brian O'Connor6f1c5672015-09-16 17:41:25 -070016
17pre-start script
Brian O'Connor8a0c20e2015-09-16 22:54:24 -070018 [ -f /opt/onos/options ] && . /opt/onos/options
19 ONOS_USER=${ONOS_USER:-root}
Bob Lantzd22c9912016-12-15 14:26:18 -080020 ONOS_GROUP=${ONOS_GROUP:-$ONOS_USER}
21 # Fix permissions and symlinks
22 mkdir -p /opt/onos/var 2>/dev/null && chown $ONOS_USER:$ONOS_GROUP /opt/onos/var
23 mkdir -p /opt/onos/config 2>/dev/null && chown $ONOS_USER:$ONOS_GROUP /opt/onos/config
24 mkdir -p /opt/onos/apps 2>/dev/null && chown -R $ONOS_USER:$ONOS_GROUP /opt/onos/apps
Yuta HIGUCHIf87603c2017-09-01 09:46:19 -070025 [ ! -h $ONOS_HOME/karaf ] && ln -s /opt/onos/apache-karaf* $ONOS_HOME/karaf || :
Bob Lantzd22c9912016-12-15 14:26:18 -080026 [ ! -h $ONOS_HOME/log ] && ln -s $ONOS_HOME/karaf/data/log $ONOS_HOME/log || :
Brian O'Connor6f1c5672015-09-16 17:41:25 -070027end script
tom0eaa97f2014-09-22 16:13:06 -070028
tomb41d1ac2014-09-24 01:51:24 -070029pre-stop script
Bob Lantz0b8466b2016-04-15 15:39:51 -070030 /opt/onos/bin/onos halt 1>>/opt/onos/var/stdout.log 2>>/opt/onos/var/stderr.log
Thomas Vachuska74bcd922015-06-02 13:08:57 -070031 sleep 1
tomb41d1ac2014-09-24 01:51:24 -070032end script
33
tom0eaa97f2014-09-22 16:13:06 -070034script
35 [ -f /opt/onos/options ] && . /opt/onos/options
Brian O'Connor6f1c5672015-09-16 17:41:25 -070036 start-stop-daemon --signal INT --start --chuid ${ONOS_USER:-root} \
37 --exec /opt/onos/bin/onos-service -- ${ONOS_OPTS:-server} \
tom0eaa97f2014-09-22 16:13:06 -070038 >/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log
39end script