1/05/2007

Robbin 所提供的 spwan-fcgi shell script

Robbin 提供一個 spwan-fcgi 的 shell script,我記錄下來,相信對於 Lighttpd + fastcgi 的使用者很好用。以下是 Robbin 所提供的 script

#!/bin/sh  
DISPATCH_PATH=/yourailsapp/public/dispatch.fcgi
SOCKET_PATH=/tmp/lighttpd/socket
RAILS_ENV=production
export RAILS_ENV

case "$1" in

start)
rm -rf $SOCKET_PATH/javaeye.socket-*
for num in 0 1 2 3 4 5 6 7 8 9
do
/usr/local/lighttpd/bin/spawn-fcgi -f $DISPATCH_PATH -s $SOCKET_PATH/javaeye.socket-$num
done
;;

stop)
killall -9 dispatch.fcgi
rm -rf $SOCKET_PATH/javaeye.socket-*
;;

restart)
$0 stop
$0 start
;;

*)
echo "Usage: dispatch.sh {start|stop|restart}"
;;

esac

exit 0

啟動前,Ruby Fastcgi ,Socket Path ,Rails Enviroment 部份要設定正確,要啟動就打
sh script-name start
即可。



沒有留言: