Commit b9ef2ea73437caa9525c7da072911a8ed631076d
1 parent
38161c46
Exists in
staging
and in
42 other branches
[search-improvements] Wrtie/clear whenever cronjob together with rails server
Showing
3 changed files
with
7 additions
and
3 deletions
Show diff stats
config/schedule.rb
| @@ -18,9 +18,8 @@ | @@ -18,9 +18,8 @@ | ||
| 18 | # end | 18 | # end |
| 19 | 19 | ||
| 20 | # Learn more: http://github.com/javan/whenever | 20 | # Learn more: http://github.com/javan/whenever |
| 21 | -# | ||
| 22 | -set :environment, 'development' | ||
| 23 | -set :output, "/home/rodrigo/noosfero/log/cron.log" | 21 | + |
| 22 | +set :output, "log/cron.log" | ||
| 24 | 23 | ||
| 25 | every 1.minute do | 24 | every 1.minute do |
| 26 | runner "SearchTerm.calculate_scores" | 25 | runner "SearchTerm.calculate_scores" |
script/development
| @@ -7,6 +7,7 @@ export RAILS_ENV=development | @@ -7,6 +7,7 @@ export RAILS_ENV=development | ||
| 7 | stop() { | 7 | stop() { |
| 8 | ./script/delayed_job stop | 8 | ./script/delayed_job stop |
| 9 | ./script/feed-updater stop | 9 | ./script/feed-updater stop |
| 10 | + whenever --clear-crontab | ||
| 10 | exit | 11 | exit |
| 11 | } | 12 | } |
| 12 | 13 | ||
| @@ -15,6 +16,7 @@ start() { | @@ -15,6 +16,7 @@ start() { | ||
| 15 | ./script/feed-updater start | 16 | ./script/feed-updater start |
| 16 | ./script/delayed_job start | 17 | ./script/delayed_job start |
| 17 | trap stop INT TERM | 18 | trap stop INT TERM |
| 19 | + whenever --write-crontab --set 'environment=development' | ||
| 18 | rails s $@ | 20 | rails s $@ |
| 19 | } | 21 | } |
| 20 | 22 |
script/production
| @@ -29,6 +29,7 @@ do_start() { | @@ -29,6 +29,7 @@ do_start() { | ||
| 29 | rake db:migrate SCHEMA=/dev/null | 29 | 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' | ||
| 32 | ruby -S thin -C config/thin.yml start | 33 | ruby -S thin -C config/thin.yml start |
| 33 | } | 34 | } |
| 34 | 35 | ||
| @@ -43,6 +44,8 @@ do_stop() { | @@ -43,6 +44,8 @@ do_stop() { | ||
| 43 | 44 | ||
| 44 | environments_loop stop || | 45 | environments_loop stop || |
| 45 | 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 | + | ||
| 48 | + whenever --clear-crontab | ||
| 46 | } | 49 | } |
| 47 | 50 | ||
| 48 | stop_via_pid_file() { | 51 | stop_via_pid_file() { |