#my rake task
namespace :send_digest_email do
desc "send digest email"
task :send_digest_email => :environment do
@sender="govind.shawas20@gmail.com"
recipient= "govind.mietcse@gmail.com" # recieprnt
@school = School.all
@school.each do |s|
MultiSchool.current_school = School.find s.id
# to send mail
FedenaEmailer::deliver_send_custom_mail(@sender,recipient)
end
end
end
every 2.minutes do
rake 'send_digest_email:send_digest_email',
:environment => 'development'
end
every :reboot do
rake 'send_digest_email:send_digest_email',
:environment => 'development'
end
#run命令开始工作。命令是
1. whenever --update-crontab store
[write] crontab file updated
2. crontab -l
# Begin Whenever generated tasks for: store @reboot /bin/bash -l -c 'cd /home/rank/gvs/new_rank/vendor/plugins/rank_gvs_customization &&
RAILS_ENV=development rake send_digest_email:send_digest_email
--silent'
0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58
* * * * /bin/bash -l -c 'cd /home/rank/gvs/new_rank/vendor/plugins/rank_gvs_customization &&
RAILS_ENV=development rake send_digest_email:send_digest_email
--silent'
#End每当生成任务时:store
1.service cron status
cron start/running, process 924
当我做rake -T并运行rake任务而不是收到邮件。