Commit 317501e26006c42358ffca5429993564f981777c
Exists in
master
and in
27 other branches
Merge branch 'update_production_script' into 'master'
Update production script - Verify if /lib/init/vars.sh file exist before source it in etc/init.d/noosfero - Add 'bundle exec' where is needed in script/production See merge request !488
Showing
2 changed files
with
12 additions
and
10 deletions
Show diff stats
etc/init.d/noosfero
@@ -36,7 +36,9 @@ NOOSFERO_USER=noosfero | @@ -36,7 +36,9 @@ NOOSFERO_USER=noosfero | ||
36 | [ -r /etc/default/$NAME ] && . /etc/default/$NAME | 36 | [ -r /etc/default/$NAME ] && . /etc/default/$NAME |
37 | 37 | ||
38 | # Load the VERBOSE setting and other rcS variables | 38 | # Load the VERBOSE setting and other rcS variables |
39 | -. /lib/init/vars.sh | 39 | +if [ -e /lib/init/vars.sh ]; then |
40 | + . /lib/init/vars.sh | ||
41 | +fi | ||
40 | 42 | ||
41 | if [ -z "$NOOSFERO_DIR" ] || [ -z "$NOOSFERO_USER" ]; then | 43 | if [ -z "$NOOSFERO_DIR" ] || [ -z "$NOOSFERO_USER" ]; then |
42 | echo "NOOSFERO_DIR or NOOSFERO_USER not defined, noosfero not being started." | 44 | echo "NOOSFERO_DIR or NOOSFERO_USER not defined, noosfero not being started." |
script/production
@@ -26,11 +26,11 @@ clear_cache() { | @@ -26,11 +26,11 @@ clear_cache() { | ||
26 | } | 26 | } |
27 | 27 | ||
28 | do_start() { | 28 | do_start() { |
29 | - rake db:migrate SCHEMA=/dev/null | 29 | + bundle exec rake db:migrate SCHEMA=/dev/null |
30 | clear_cache | 30 | clear_cache |
31 | environments_loop start | 31 | environments_loop start |
32 | - whenever --write-crontab --set 'environment=production' | ||
33 | - ruby -S thin -C config/thin.yml start | 32 | + bundle exec whenever --write-crontab --set 'environment=production' |
33 | + ruby -S bundle exec thin -C config/thin.yml start | ||
34 | } | 34 | } |
35 | 35 | ||
36 | do_stop() { | 36 | do_stop() { |
@@ -39,23 +39,23 @@ do_stop() { | @@ -39,23 +39,23 @@ do_stop() { | ||
39 | # back to stopping the daemons by manually reading their PID files, killing | 39 | # back to stopping the daemons by manually reading their PID files, killing |
40 | # them and wiping the PID files. | 40 | # them and wiping the PID files. |
41 | 41 | ||
42 | - ruby -S thin -C config/thin.yml stop || | 42 | + ruby -S bundle exec thin -C config/thin.yml stop || |
43 | stop_via_pid_file tmp/pids/thin.*.pid | 43 | stop_via_pid_file tmp/pids/thin.*.pid |
44 | 44 | ||
45 | environments_loop stop || | 45 | environments_loop stop || |
46 | stop_via_pid_file tmp/pids/delayed_job.pid tmp/pids/delayed_job.*.pid tmp/pids/feed-updater.*.pid | 46 | stop_via_pid_file tmp/pids/delayed_job.pid tmp/pids/delayed_job.*.pid tmp/pids/feed-updater.*.pid |
47 | 47 | ||
48 | - whenever --clear-crontab | 48 | + bundle exec whenever --clear-crontab |
49 | } | 49 | } |
50 | 50 | ||
51 | do_restart() { | 51 | do_restart() { |
52 | - rake db:migrate SCHEMA=/dev/null | 52 | + bundle exec rake db:migrate SCHEMA=/dev/null |
53 | environments_loop stop || | 53 | environments_loop stop || |
54 | stop_via_pid_file tmp/pids/delayed_job.pid tmp/pids/delayed_job.*.pid tmp/pids/feed-updater.*.pid | 54 | stop_via_pid_file tmp/pids/delayed_job.pid tmp/pids/delayed_job.*.pid tmp/pids/feed-updater.*.pid |
55 | environments_loop start | 55 | environments_loop start |
56 | 56 | ||
57 | clear_cache | 57 | clear_cache |
58 | - ruby -S thin -C config/thin.yml restart --onebyone | 58 | + ruby -S bundle exec thin -C config/thin.yml restart --onebyone |
59 | } | 59 | } |
60 | 60 | ||
61 | stop_via_pid_file() { | 61 | stop_via_pid_file() { |
@@ -76,11 +76,11 @@ environments_loop() { | @@ -76,11 +76,11 @@ environments_loop() { | ||
76 | for environment in $environments; do | 76 | for environment in $environments; do |
77 | env=$(basename $environment | cut -d. -f1) | 77 | env=$(basename $environment | cut -d. -f1) |
78 | RAILS_ENV=$env ./script/delayed_job -i $env "$action" | 78 | RAILS_ENV=$env ./script/delayed_job -i $env "$action" |
79 | - RAILS_ENV=$env ./script/feed-updater "$action" -i $env | 79 | + RAILS_ENV=$env bundle exec ./script/feed-updater "$action" -i $env |
80 | done | 80 | done |
81 | else | 81 | else |
82 | ./script/delayed_job "$action" | 82 | ./script/delayed_job "$action" |
83 | - ./script/feed-updater "$action" | 83 | + bundle exec ./script/feed-updater "$action" |
84 | fi | 84 | fi |
85 | } | 85 | } |
86 | 86 |