production
1 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
export RAILS_ENV=production
ACTION=$1
shift
clear_cache() {
rm -f ./public/javascripts/cache-*.js
rm -f ./public/stylesheets/cache.css
}
do_start() {
if ! rake db:abort_if_pending_migrations; then
echo "========================================"
echo "There are pending migrations, please upgrade the database before starting the production server"
exit 1
fi
clear_cache
./script/ferret_server -e $RAILS_ENV start
./script/feed-updater start
./script/delayed_job start
mongrel_rails cluster::start
}
do_stop() {
mongrel_rails cluster::stop
./script/delayed_job stop
./script/feed-updater stop
./script/ferret_server -e $RAILS_ENV stop
}
case "$ACTION" in
start|stop)
do_$ACTION
;;
run)
do_start
echo "=> Running in production mode. Hit ctrl-C to stop."
trap do_stop INT TERM
tail -n 0 -f log/production.log
;;
restart)
do_stop
sleep 1
do_start
;;
*)
echo "usage: $0 start|stop|restart|run"
exit 1
;;
esac