ff39720c1905b7cbcc56e6ac3e6bc8771462c614
[openstack-build/neutron-build.git] / xenial / debian / neutron-server.upstart.in
1 description "Neutron server"
2 author "Thomas Goirand <zigo@debian.org>"
3
4 start on runlevel [2345]
5 stop on runlevel [016]
6
7 chdir /var/run
8
9 pre-start script
10         mkdir -p /var/run/neutron
11         chown neutron:root /var/run/neutron
12 end script
13
14 script
15         [ -r /usr/share/neutron-common/plugin_guess_func ] || exit 0
16         . /usr/share/neutron-common/plugin_guess_func
17
18         [ -r /etc/default/openstack ] && . /etc/default/openstack
19         [ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB
20
21         [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
22         [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/neutron/server.log"
23
24         if ! [ -r /etc/neutron/neutron.conf ] ; then
25                 echo "Cloud not read /etc/neutron/neutron.conf: exiting"
26                 exit 0
27         fi
28         CURRENT_PLUGIN=`grep "^[ \t]*core_plugin[ \t]*=[ \t]*[._a-zA-Z0-9]*\$" /etc/neutron/neutron.conf | sed -e 's/^[ \t]*core_plugin[ \t]*=[ \t]*//'`
29         if [ -z "${CURRENT_PLUGIN}" ] ; then
30                 echo "No core_plugin= value found: please set it and try again"
31                 exit 0
32         fi
33
34         neutron_core_plugin_to_plugin_name ${CURRENT_PLUGIN}
35         neutron_plugin_ini_path ${NEUTRON_PLUGIN_NAME}
36         [ -r "$NEUTRON_PLUGIN_CONFIG" ] && CONF_ARG="--config-file $NEUTRON_PLUGIN_CONFIG"
37         exec start-stop-daemon --start --chuid neutron:neutron --exec /usr/bin/neutron-server -- \
38             --config-file /etc/neutron/neutron.conf \
39             $DAEMON_ARGS $CONF_ARG
40 end script