File openstack-swift-container.init of Package openstack-swift

#!/bin/sh

### BEGIN INIT INFO
# Provides:          openstack-swift-container
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Default-Start:     3 5
# Default-Stop:      0 1 6
# Short-Description: Swift container server
# Description:       Container server for swift.
### END INIT INFO

# openstack-swift-container: swift container server
#
# chkconfig: - 20 80
# description: Container server for swift.

. /etc/rc.status
. /usr/share/openstack-swift/functions

name="container"
server="swift-cont-server"
config="/etc/swift/container-server.conf"
CHUSER="-u swift"

[ -e "/etc/sysconfig/openstack-swift-$name" ] && . "/etc/sysconfig/openstack-swift-$name"


mkvarrun() {
    test -d /var/run/swift         || mkdir /var/run/swift
    test -d /var/run/swift/${name} || mkdir /var/run/swift/${name}
}

mkvarrun

case "$1" in
    start)
        echo -n "Starting $server"
        startproc $CHUSER /usr/bin/$server $config
        rc_status -v
        ;;
    stop)
        echo -n "Shutting down $server"
        killproc /usr/bin/$server
        rc_status -v
        ;;
    restart)
        $0 stop
        $0 start
        rc_status
        ;;
    reload)
        ;;
    status)
        echo -n "Checking $server"
        /sbin/checkproc /usr/bin/$server
        rc_status -v
        ;;
    condrestart|try-restart)
  	$0 status
	if test $? = 0; then
		$0 restart
	else
		rc_reset	# Not running is not a failure.
	fi
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|try-restart}"
        exit 2
esac
exit $?