#!/bin/bash
#
### BEGIN INIT INFO
# Provides: mongrel_cluster
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Mongrel Cluster init script
# Description: Init script for mongrel server
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/var/lib/gems/1.8/bin
DAEMON="/usr/bin/mongrel_rails"
CONF_DIR=/var/zena/current
RETVAL=0
# Gracefully exit if the controller is missing.
test -x $DAEMON || exit 0
# Go no further if config directory is missing.
[ -d "$CONF_DIR" ] || exit 0
case "$1" in
start)
cd $CONF_DIR && $DAEMON cluster::start
RETVAL=$?
;;
stop)
cd $CONF_DIR && $DAEMON cluster::stop
RETVAL=$?
;;
restart)
cd $CONF_DIR && $DAEMON cluster::restart
RETVAL=$?
;;
*)
echo "Usage: mongrel_cluster {start|stop|restart}"
exit 1
;;
esac
exit $RETVAL