LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File openstack-manila.init of Package openstack-manila (Project home:mmnelemane:branches:Cloud:OpenStack:Mitaka)

#!/bin/sh

### BEGIN INIT INFO
# Provides:          openstack-manila-__NAME__
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      mysql postgresql rabbitmq-server openstack-keystone
# Should-Stop:       mysql postgresql rabbitmq-server openstack-keystone
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: OpenStack shared file system service (Manila) - __NAME__
# Description:       OpenStack shared file system service (Manila) - __NAME__
### END INIT INFO

DAEMON="__NAME__"
USER="manila"
CONFFILE="/etc/manila/manila.conf"
RUNDIR="/var/run/manila"

# $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)
        if [ "$DAEMON"  = "api" ]; then
            echo -n "Checking for DB Migrations"
            su $USER -s /bin/sh -c "/usr/bin/manila-manage db sync"
            rc_status -v
        fi

        echo -n "Starting manila-$DAEMON"
        su $USER -s /bin/sh -c "/sbin/startproc -q -s /usr/bin/manila-$DAEMON --config-file=$CONFFILE"
        rc_status -v
        ;;
    stop)
        echo -n "Shutting down manila-$DAEMON"
        /sbin/killproc /usr/bin/manila-$DAEMON
        rc_status -v
        ;;
    restart)
        $0 stop
        $0 start
        rc_status
        ;;
    force-reload)
        $0 try-restart
        rc_status
        ;;
    reload)
        echo -n "Reload service manila-$DAEMON"
        rc_failed 3
        rc_status -v
        ;;
    status)
        echo -n "Checking for service manila-$DAEMON"
        /sbin/checkproc /usr/bin/manila-$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