I am using Whenever gem to schedule some work on my site. Currently I am working on development environment.
I have instaled gem as guide suggests.
In schedule.rb
every 2.minutes do
rake "vip_recomend:give"
end
In lib/tasks/vip_recomend.rake
namespace :vip_recomend do
desc "Give vip recomend to ads that are in waiting list"
task give: :environment do
girls = Girl.all
girls.each do |girl|
BlacklistMailer.blacklisted(girl).deliver
end
user = User.first
UserMailer.password_reset(user).deliver
end
end
Then I tried these comands:
whenever --set environment=development --update-crontab
or
whenever --update-crontab
Nothing happens.
Then I check if cron is updated with my stuff with this:
crontab -l
Output:
# Begin Whenever generated tasks for: /home/my_host/blogs/config/schedule.rb
* * * * * /bin/bash -l -c 'cd /home/my_host/blogs && RAILS_ENV=development bundle exec rake vip_recomend:give --silent >> /log/cron_log.log 2>&1'
# End Whenever generated tasks for: /home/my_host/blogs/config/schedule.rb
When I try to run rake task from console it works.
Any help on this? Thanks.
Aucun commentaire:
Enregistrer un commentaire