Created
October 5, 2010 21:05
-
-
Save flippyhead/612337 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Copyright (c) 2007 Bradley Taylor, [email protected] | |
# | |
# mongrel_cluster Startup script for Mongrel clusters. | |
# | |
# chkconfig: - 85 15 | |
# description: mongrel_cluster manages multiple Mongrel processes for use \ | |
# behind a load balancer. | |
# | |
# source /usr/local/rvm/scripts/rvm | |
# rvm use 1.8.7 | |
source /usr/local/rvm/environments/ruby-1.8.7-p302 | |
CONF_DIR=/etc/mongrel_cluster | |
PID_DIR=/var/run/mongrel_cluster | |
USER=mongrel | |
RETVAL=0 | |
# Gracefully exit if the controller is missing. | |
which mongrel_cluster_ctl >/dev/null || exit 0 | |
# Go no further if config directory is missing. | |
[ -d "$CONF_DIR" ] || exit 0 | |
case "$1" in | |
start) | |
# Create pid directory | |
mkdir -p $PID_DIR | |
chown $USER:$USER $PID_DIR | |
mongrel_cluster_ctl start -c $CONF_DIR | |
RETVAL=$? | |
;; | |
stop) | |
mongrel_cluster_ctl stop -c $CONF_DIR | |
RETVAL=$? | |
;; | |
restart) | |
mongrel_cluster_ctl restart -c $CONF_DIR | |
RETVAL=$? | |
;; | |
status) | |
mongrel_cluster_ctl status -c $CONF_DIR | |
RETVAL=$? | |
;; | |
*) | |
echo "Usage: mongrel_cluster {start|stop|restart|status}" | |
exit 1 | |
;; | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment