Browse files

fix `sr` (server restart) and `sst` (server stop) for Rails 2.3 where…

… the pid is in tmp/pids/server.pid
  • Loading branch information...
1 parent 6fa5266 commit 588f6dd08a07a639d0dd5feee6ffde49a9226d01 @mislav mislav committed Feb 18, 2009
Showing with 15 additions and 2 deletions.
  1. +15 −2 bash_aliases
View
17 bash_aliases
@@ -76,13 +76,26 @@ alias fri='fri -w 98'
#########
alias sc='script/console'
alias ss='script/server' # start up the beast; use "ss -d" to detach
-alias sst='kill `cat tmp/pids/mongrel.pid`' # stop daemonized Mongrel
-alias a='autotest -rails'
+# stop daemonized Rails server
+function sst() {
+ if [ -f tmp/pids/mongrel.pid ]; then
+ echo "Stopping Mongrel ..."
+ kill `cat tmp/pids/mongrel.pid`
+ elif [ -f tmp/pids/server.pid ]; then
+ echo "Stopping server ..."
+ kill `cat tmp/pids/server.pid`
+ fi
+}
+
+# restart Rails application
function sr() {
if [ -f tmp/pids/mongrel.pid ]; then
echo "Restarting Mongrel ..."
kill -USR2 `cat tmp/pids/mongrel.pid`
+ elif [ -f tmp/pids/server.pid ]; then
+ echo "Restarting server ..."
+ kill -USR2 `cat tmp/pids/server.pid`
else
echo "Restarting Passenger instances ..."
touch tmp/restart.txt

0 comments on commit 588f6dd

Please sign in to comment.