File openstack-neutron-zvm-agent.init of Package openstack-neutron-zvm-agent

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

NEUTRON_SYSCONFIG=/etc/sysconfig/neutron
DAEMON="zvm-agent"
USER="neutron"
CONFFILE="/etc/neutron/neutron.conf"
RUNDIR="/var/run/neutron"

NEUTRON_PLUGIN_CONF="/etc/neutron/plugins/zvm/neutron_zvm_plugin.ini"
NEUTRON_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"
        /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
openSUSE Build Service is sponsored by