Thomas Vachuska | 9edca30 | 2014-11-22 17:06:42 -0800 | [diff] [blame] | 1 | description "Open Network Operating System" |
Yuta HIGUCHI | f87603c | 2017-09-01 09:46:19 -0700 | [diff] [blame] | 2 | author "Open Networking Foundation" |
tom | 0eaa97f | 2014-09-22 16:13:06 -0700 | [diff] [blame] | 3 | |
Bob Lantz | d22c991 | 2016-12-15 14:26:18 -0800 | [diff] [blame] | 4 | # onos.conf: ONOS service configuration for upstart-based systems |
| 5 | |
tom | 0eaa97f | 2014-09-22 16:13:06 -0700 | [diff] [blame] | 6 | start on (net-device-up |
| 7 | and local-filesystems |
| 8 | and runlevel [2345]) |
| 9 | stop on runlevel [016] |
| 10 | |
| 11 | console output |
| 12 | kill timeout 60 |
| 13 | respawn |
| 14 | |
| 15 | env LANG=en_US.UTF-8 |
Brian O'Connor | 6f1c567 | 2015-09-16 17:41:25 -0700 | [diff] [blame] | 16 | |
| 17 | pre-start script |
Brian O'Connor | 8a0c20e | 2015-09-16 22:54:24 -0700 | [diff] [blame] | 18 | [ -f /opt/onos/options ] && . /opt/onos/options |
| 19 | ONOS_USER=${ONOS_USER:-root} |
Bob Lantz | d22c991 | 2016-12-15 14:26:18 -0800 | [diff] [blame] | 20 | 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 HIGUCHI | f87603c | 2017-09-01 09:46:19 -0700 | [diff] [blame] | 25 | [ ! -h $ONOS_HOME/karaf ] && ln -s /opt/onos/apache-karaf* $ONOS_HOME/karaf || : |
Bob Lantz | d22c991 | 2016-12-15 14:26:18 -0800 | [diff] [blame] | 26 | [ ! -h $ONOS_HOME/log ] && ln -s $ONOS_HOME/karaf/data/log $ONOS_HOME/log || : |
Brian O'Connor | 6f1c567 | 2015-09-16 17:41:25 -0700 | [diff] [blame] | 27 | end script |
tom | 0eaa97f | 2014-09-22 16:13:06 -0700 | [diff] [blame] | 28 | |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 29 | pre-stop script |
Bob Lantz | 0b8466b | 2016-04-15 15:39:51 -0700 | [diff] [blame] | 30 | /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] | 31 | sleep 1 |
tom | b41d1ac | 2014-09-24 01:51:24 -0700 | [diff] [blame] | 32 | end script |
| 33 | |
tom | 0eaa97f | 2014-09-22 16:13:06 -0700 | [diff] [blame] | 34 | script |
| 35 | [ -f /opt/onos/options ] && . /opt/onos/options |
Brian O'Connor | 6f1c567 | 2015-09-16 17:41:25 -0700 | [diff] [blame] | 36 | start-stop-daemon --signal INT --start --chuid ${ONOS_USER:-root} \ |
| 37 | --exec /opt/onos/bin/onos-service -- ${ONOS_OPTS:-server} \ |
tom | 0eaa97f | 2014-09-22 16:13:06 -0700 | [diff] [blame] | 38 | >/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log |
| 39 | end script |