rosa-build/script/unicorn

62 lines
1006 B
Plaintext
Raw Normal View History

2011-10-25 14:23:20 +01:00
#!/bin/sh
2011-10-25 14:32:16 +01:00
current_path="/var/www/rosa_build/current"
2011-10-25 14:23:20 +01:00
getpid() {
pid=`ps ax |grep "unicorn_rails master -c /var/www/rosa_build" \
|grep -v grep \
|awk '{print $1}'`;
}
start() {
export RUBY_HEAP_MIN_SLOTS=1400000
export RUBY_HEAP_SLOTS_INCREMENT=500000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=30000000
export RUBY_HEAP_FREE_MIN=12500
cd $current_path && \
bundle exec unicorn_rails -c $current_path/config/unicorn.rb -E production -D
}
stop() {
while : ; do
getpid;
if [ x"$pid" != x"" ] ; then
kill $pid;
sleep 1;
else
break;
fi
done
}
reload() {
getpid;
if [ x"$pid" != x"" ] ; then
kill -USR2 $pid;
else
start;
fi
}
case "$1" in
start)
start
;;
stop)
stop;
;;
reload)
reload
;;
*)
echo $"Usage: $0 {start|stop|reload}"
exit 2
esac