diff options
-rw-r--r-- | config/foimongreld.ugly | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/config/foimongreld.ugly b/config/foimongreld.ugly deleted file mode 100644 index 6f27a0a7d..000000000 --- a/config/foimongreld.ugly +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/bash -# -# !!(*= $daemon_name *)!! Start the WhatDoTheyKnow web server daemon (mongrel) - -# XXX remove this after a while - no longer used now we use Passenger - -NAME=!!(*= $daemon_name *)!! -RUNDIR=/data/vhost/!!(*= $vhost *)!!/mysociety/foi -PIDDIR=/data/vhost/!!(*= $vhost *)!!/mysociety/foi/log -DUSER=!!(*= $user *)!! - -# number of ports = number of instances - also need to change config/httpd.conf -# to actually use the new mongrels. -PORTS="3000 3001 3002 3003 3004 3005 3006 3007" - -function stop_mongrels { - - for PORT in $PORTS - do - stop_mongrel - done - - sleep 5s - - for PORT in $PORTS - do - check_stopped - done -} - -function start_mongrels { - for PORT in $PORTS - do - start_mongrel - done -} - -function stop_mongrel { - PIDFILE=$PIDDIR/mongrel.$PORT.pid - - if [ -e $PIDFILE ] - then - su $DUSER -c "cd $RUNDIR; /usr/bin/ruby -I/usr/lib/ruby/ /usr/bin/mongrel_rails stop -p $PORT -P $PIDFILE" - else - echo " pidfile does not exist, start first " - return 1 - fi -} - -function check_stopped { - PIDFILE=$PIDDIR/mongrel.$PORT.pid - - if [ -e $PIDFILE ] - then - if ( ps h -p `cat $PIDFILE` ) - then - echo "kill -9 ing `cat $PIDFILE` because it failed to stop" - kill -9 `cat $PIDFILE` - sleep 2s - fi - fi - if [ -e $PIDFILE ] - then - rm $PIDFILE - fi -} - -function start_mongrel { - PIDFILE=$PIDDIR/mongrel.$PORT.pid - - if [ -e $PIDFILE ] - then - echo " pidfile already exists, stop first " - return 1 - else - su $DUSER -c "cd $RUNDIR; /usr/bin/ruby -I/usr/lib/ruby/ /usr/bin/mongrel_rails start -d -p $PORT -P $PIDFILE" - fi -} - -trap "" 1 - -case "$1" in - start) - echo -n "Starting WhatDoTheyKnow web server daemons (mongrel): $NAME" - start_mongrels - ;; - - stop) - echo -n "Stopping WhatDoTheyKnow web server daemons (mongrel): $NAME" - stop_mongrels - ;; - - restart) - echo -n "Restarting WhatDoTheyKnow web server daemons (mongrel): $NAME" - stop_mongrels - start_mongrels - ;; - - *) - echo "Usage: /etc/init.d/$NAME {start|stop|restart}" - exit 1 - ;; -esac - -if [ $? -eq 0 ]; then - echo . - exit 0 -else - echo " failed" - exit 1 -fi - |