aboutsummaryrefslogtreecommitdiffstats
path: root/script/restart-mongrel
blob: 9de4122a0f884ce9ea542d3d9e90681db5267571 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

# Stops and restarts the Mongrel web server.

cd `dirname $0`
cd ..
# XXX Include path for dodgy version of daemonize package
if [ -e log/mongrel.pid ]
then
    ruby -I/usr/lib/ruby/ /usr/bin/mongrel_rails stop
    sleep 5s
    if [ -e log/mongrel.pid ]
    then
	    if ( ps h -p `cat log/mongrel.pid`45 )
	    then
	    	echo "kill -9 ing `cat log/mongrel.pid` because it failed to stop"
	    	kill -9 `cat log/mongrel.pid`
		sleep 2s
	    fi
	    if [ -e log/mongrel.pid ]
	    	rm log/mongrel.pid
	    fi
    fi
    ruby -I/usr/lib/ruby/ /usr/bin/mongrel_rails start -d --debug
else
    ruby -I/usr/lib/ruby/ /usr/bin/mongrel_rails start -d --debug
fi