Ok... here you go...
If anybody else is facing my little issue... Basically I ve
transferred the logic to restart webrick into a little unix shell
script (I ve made user and webrick port configurable...).
1. add this to your deploy file:
task :restart_web_server, :roles => :web do
run "#{current_path}/webctl restart #{dev_user} #{dev_port}"
end
after "deploy:start", :restart_web_server
webctl looks like this:
#!/bin/sh
if [ -n "$2" ]; then
USER="$2"
fi
if [ -n "$3" ]; then
PORT="$3"
fi
GMS_HOME="/export/home1/$USER/gui_cms/current"
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/export/home/ruby/bin
export USER PORT GMS_HOME
case "$1" in
'start')
if [ -n "$GMS_HOME" ]; then
# Check if webrick is still running
WEBRICKPID=`ps -ef | grep "p $PORT" | egrep -v grep | awk
'{print $2}'`
if [ ! -z "$WEBRICKPID" ]; then
echo "Warning: Webrick process is still running. Check
pid: $WEBRICKPID"
echo " Please stop the application completely
before starting."
exit 1
fi
echo "Starting Webrick..."
ruby $GMS_HOME/script/server -b devomp01 -p $PORT -d >>
$GMS_HOME/log/startup.log 2>&1
sleep 3
fi
;;
'stop')
if [ -n "$GMS_HOME" ]; then
# Check if webrick is running
WEBRICKPID=`ps -ef | grep "p $PORT" | egrep -v grep | awk
'{print $2}'`
if [ ! -z "$WEBRICKPID" ]; then
echo "Killing Webrick..."
/usr/bin/kill -9 ${WEBRICKPID} 1> /dev/null 2>&1
fi
fi
;;
'restart')
$0 stop
sleep 2
$0 start $USER $PORT
;;
*)
echo "Usage: $0 { start | stop | restart } user port"
;;
esac
exit 0
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---