Files
grecia/config/schedule.rb
Javi Martín 3cdf7194a0 Use bundle exec to run delayed jobs on reboot
When running delayed_job on reboot using Consul Democracy 2.2.0, we were
getting an error:

```
`require': cannot load such file -- sassc-embedded (LoadError)
from <internal:rubygems/core_ext/kernel_require.rb>:86:in `require'
from config/application.rb:1:in
```

No idea why this gem isn't detected when running `bin/delayed_job`.
When deploying with Capistrano, we use `bundle exec bin/delayed_job`,
and that works fine, so we're using it here as well.

We had already fixed this issue in the Cosul Democracy installer [1],
but forgot to configure the Cron job to do the same.

[1] https://github.com/consuldemocracy/installer/commit/3dc69eb6
2024-09-18 14:13:22 +02:00

42 lines
990 B
Ruby

# Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# Example:
#
# set :output, "/path/to/my/cron_log.log"
#
# every 2.hours do
# command "/usr/bin/some_great_command"
# runner "MyModel.some_method"
# rake "some:great:rake:task"
# end
#
# every 4.days do
# runner "AnotherModel.prune_old_records"
# end
# Learn more: http://github.com/javan/whenever
every 1.minute do
command "date > ~/cron-test.txt"
end
every 1.day, at: "5:00 am" do
rake "-s sitemap:refresh:no_ping"
end
every 1.day, at: "1:00 am", roles: [:cron] do
rake "files:remove_old_cached_attachments"
end
every 1.day, at: "3:00 am", roles: [:cron] do
rake "votes:reset_hot_score"
end
every :reboot do
# Number of workers must be kept in sync with capistrano's delayed_job_workers
command "cd #{@path} && RAILS_ENV=#{@environment} bundle exec bin/delayed_job -m -n 2 restart"
end