Commit aa60018e1a9a9b831a5615dbb7d62f0a5ff2fa21
1 parent
d0adb661
Exists in
master
and in
22 other branches
script/development: handle RAILS_RELATIVE_ROOT_URL better
thin by default would not watch the development log file
Showing
1 changed file
with
17 additions
and
1 deletions
Show diff stats
script/development
@@ -5,8 +5,13 @@ set -e | @@ -5,8 +5,13 @@ set -e | ||
5 | export RAILS_ENV=development | 5 | export RAILS_ENV=development |
6 | 6 | ||
7 | stop() { | 7 | stop() { |
8 | + echo "Stopping ..." | ||
8 | ./script/delayed_job stop | 9 | ./script/delayed_job stop |
9 | ./script/feed-updater stop | 10 | ./script/feed-updater stop |
11 | + if [ -f tmp/pids/thin.pid ]; then | ||
12 | + kill -9 $(cat tmp/pids/thin.pid) | ||
13 | + rm -f tmp/pids/thin.pid | ||
14 | + fi | ||
10 | exit | 15 | exit |
11 | } | 16 | } |
12 | 17 | ||
@@ -15,7 +20,18 @@ start() { | @@ -15,7 +20,18 @@ start() { | ||
15 | ./script/feed-updater start | 20 | ./script/feed-updater start |
16 | ./script/delayed_job start | 21 | ./script/delayed_job start |
17 | trap stop INT TERM | 22 | trap stop INT TERM |
18 | - rails s $@ | 23 | + if [ -z "$RAILS_RELATIVE_URL_ROOT" ]; then |
24 | + rails s $@ | ||
25 | + else | ||
26 | + mkdir -p log | ||
27 | + touch log/development.log | ||
28 | + thin \ | ||
29 | + --prefix "$RAILS_RELATIVE_URL_ROOT" \ | ||
30 | + --pid tmp/pids/thin.pid \ | ||
31 | + --daemonize \ | ||
32 | + start | ||
33 | + tail -n 0 -f log/development.log || true | ||
34 | + fi | ||
19 | } | 35 | } |
20 | 36 | ||
21 | start $@ | 37 | start $@ |