Sha256: 6a0c6997e174ac8f0788a8e97913d0b6254d4b9a4e3e6fefde173fabb4519e6f

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

#!/bin/bash
#
# Copyright (c) 2007 Bradley Taylor, bradley@railsmachine.com
#
# mongrel_cluster_<%= application %>   Startup script for Mongrel clusters (<%= application %>)
#
# chkconfig: - 85 15
# description: mongrel_cluster_<%= application %> manages multiple Mongrel processes for use \
#              behind a load balancer.
#
# Modified by: Gabriel Handford http://ducktyper.com
#              

set -e
trap ERROR ERR

CONF_DIR=<%= mongrel_config_dir %>
PID_DIR=<%= mongrel_pid_dir %>
USER=<%= user %>

RETVAL=0

fail() {
  echo "Failed to start: $1"
  exit 1
}

# Gracefully exit if the controller is missing.
which mongrel_cluster_ctl >/dev/null || fail "mongrel_cluster_ctl not found"

# Go no further if config directory is missing.
[ -d "$CONF_DIR" ] || fail "$CONF_DIR not found"

case "$1" in
    start)
      # Create pid directory
      mkdir -p $PID_DIR
      chown $USER:$USER $PID_DIR

      mongrel_cluster_ctl start -c $CONF_DIR --clean
      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: $0 {start|stop|restart|status}"
      exit 1
  ;;
esac      

exit $RETVAL

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
capitate-0.2.2 lib/templates/mongrel/mongrel_cluster.initd.erb
capitate-0.2.3 lib/templates/mongrel/mongrel_cluster.initd.erb