LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File openstack-neutron-plugin.init of Package openstack-neutron (Project home:abel:branches:Cloud:OpenStack:Mitaka:Staging)

#!/bin/bash
### BEGIN INIT INFO
# Provides:          openstack-neutron-__NAME__
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      mysql postgresql rabbitmq-server neutron-ovs-cleanup openstack-keystone
# Should-Stop:       mysql postgresql rabbitmq-server neutron-ovs-cleanup openstack-keystone
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: OpenStack Networking (Neutron) - __NAME__
# Description:       OpenStack Networking (Neutron) - __NAME__ 
### END INIT INFO

NEUTRON_SYSCONFIG=/etc/sysconfig/neutron
DAEMON="__NAME__"
USER="neutron"
CONFFILE="/etc/neutron/neutron.conf"
RUNDIR="/var/run/neutron"

NEUTRON_PLUGIN_CONF="__PLUGIN_CONFFILE__"
NEUTRON_OPT_CONFFILES="__PLUGIN_OPT_CONFFILES__"

if [ -n "$NEUTRON_PLUGIN_CONF" ] ; then
    PLUGIN_ARGS="--config-file=$NEUTRON_PLUGIN_CONF"
fi

if [ -n "$NEUTRON_OPT_CONFFILES" ]; then
    for f in $NEUTRON_OPT_CONFFILES; do
        if [ -r "$f" ]; then
            PLUGIN_ARGS+=" --config-file=$f"
        fi
    done
fi

# $RUNDIR can be tmpfs, thus we have to create/own it here:
mkdir -p $RUNDIR && chown $USER. $RUNDIR

. /etc/rc.status

case "$1" in
    start)
        echo -n "Starting neutron-$DAEMON"
        # Set the umask to systemd, sysinit or pacemaker
        umask 0022
        /sbin/startproc -q -s -u $USER /usr/bin/neutron-$DAEMON --config-file=$CONFFILE $PLUGIN_ARGS
        rc_status -v
        ;;
    stop)
        echo -n "Shutting down neutron-$DAEMON"
        /sbin/killproc /usr/bin/neutron-$DAEMON
        rc_status -v
        ;;
    restart)
        $0 stop
        $0 start
        rc_status
        ;;
    force-reload)
        $0 try-restart
        rc_status
        ;;
    reload)
        echo -n "Reload service neutron-$DAEMON"
        rc_failed 3
        rc_status -v
        ;;
    status)
        echo -n "Checking for service neutron-$DAEMON"
        /sbin/checkproc /usr/bin/neutron-$DAEMON
        rc_status -v
        ;;
    try-restart|condrestart)
        if test "$1" = "condrestart"; then
            echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
        fi
        $0 status
        if test $? = 0; then
            $0 restart
        else
            rc_reset # Not running is not a failure.
        fi
        rc_status # Remember status and be quiet
        ;;
    *)
        echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
        exit 1
        ;;
esac
rc_exit