From: Paul Tipper Date: Sat, 20 Nov 2010 19:01:23 +0000 (+0000) Subject: catalyst restart script X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e1f69a72f1a424d5795dfa908564f0e219062728;p=p5sagit%2FOyster.git catalyst restart script --- diff --git a/share/deploy/git/catalyst-restart.sh b/share/deploy/git/catalyst-restart.sh new file mode 100644 index 0000000..bae2a8e --- /dev/null +++ b/share/deploy/git/catalyst-restart.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +# Really this should suck less, its a crap version of this: +# http://use.perl.org/~zzo/journal/34146 + +PROJECT=foo +APP_PATH=/path/to/checkout +FCGI_SOCKET_PATH=/tmp/$PROJECT.prod.socket +PID_PATH=/var/run/$PROJECT.prod.pid + +case $1 in + start) + echo -n "Starting PROD MT: mt_fastcgi.pl" + cd $APP_PATH + script/${PROJECT}_fastcgi.pl -l $FCGI_SOCKET_PATH -p $PID_PATH -d -n 5 + echo + + # make real sure it's started + PID=`cat $PID_PATH` + if [ -n "$PID" ] + then + echo "Started" + else + echo "Start failed - trying again" + unlink $FCGI_SOCKET_PATH + $0 start + fi + + ;; + + stop) + echo -n "Stopping PROD MT: " + PID=`cat $PID_PATH` + if [ -n "$PID" ] + then + echo -n kill $PID + kill $PID + echo + unlink $FCGI_SOCKET_PATH + else + echo $PROJECT not running + fi + ;; + + restart|force-reload) + $0 stop + sleep 10 + $0 start + ;; + + *) + echo "Usage: $0 { stop | start | restart }" + exit 1 + ;; +esac