Clarified what name is needed to be provided
[p5sagit/Oyster.git] / share / deploy / git / catalyst-restart.sh
CommitLineData
5ce3db7d 1#!/bin/bash
e1f69a72 2
3# Really this should suck less, its a crap version of this:
4# http://use.perl.org/~zzo/journal/34146
5
5ce3db7d 6# Work out what our projects called, we must be called from the top level with
7# a scripts/ directory
8
9RESTART_SCRIPT=$( find script/ -type f -name '*_fastcgi.pl' )
10#APP_PATH=/path/to/checkout
e1f69a72 11FCGI_SOCKET_PATH=/tmp/$PROJECT.prod.socket
12PID_PATH=/var/run/$PROJECT.prod.pid
13
14case $1 in
15 start)
5ce3db7d 16 echo -n "Starting PROD: $RESTART_SCRIPT"
17 $RESTART_SCRIPT -l $FCGI_SOCKET_PATH -p $PID_PATH -d -n 5
e1f69a72 18 echo
19
20 # make real sure it's started
21 PID=`cat $PID_PATH`
22 if [ -n "$PID" ]
23 then
24 echo "Started"
25 else
26 echo "Start failed - trying again"
27 unlink $FCGI_SOCKET_PATH
28 $0 start
29 fi
30
31 ;;
32
33 stop)
34 echo -n "Stopping PROD MT: "
35 PID=`cat $PID_PATH`
36 if [ -n "$PID" ]
37 then
38 echo -n kill $PID
39 kill $PID
40 echo
41 unlink $FCGI_SOCKET_PATH
42 else
43 echo $PROJECT not running
44 fi
45 ;;
46
47 restart|force-reload)
48 $0 stop
49 sleep 10
50 $0 start
51 ;;
52
53 *)
54 echo "Usage: $0 { stop | start | restart }"
55 exit 1
56 ;;
57esac