in schedule.rb
every :wednesday, :at => '3pm' do
runner "UsersMailer.weekly_mail"
end
in users_mailer.rb
default :to => User.all.map(&:email)
def weekly_mail
mail(:subject => "Weekly email from footyaddicts")
end
However I am not getting any mails. Any clue what might be wrong?
Thanks,
--
You received this message because you are subscribed to the Google
Groups "Whenever Gem" group and because you're awesome.
To post to this group, send email to whenev...@googlegroups.com
To unsubscribe from this group, send email to
whenever-gem...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/whenever-gem?hl=en
As per your suggestion, I made changes in the code and here is how it
looks right now :-
1) scheduler.rb
every :wednesday, :at => "8:20pm" do
runner "User.weekly_update"
end
2) user.rb
def weekly_update
@user = User.all
@user.each do |u|
UsersMailer.weekly_mail(u.email).deliver
end
end
3) users_mailer.rb
def weekly_mail(email)
mail(:to => email:subject => "Weekly email from footyaddicts")
end
is there something which I am doing terribly wrong?
Thanks
I also suggest you run User.weekly_update from the console first to help spot any syntax errors. Or even better, write a unit test.
-Javan
I am testing it in the development environment.
Thanks,
0,10,20,30,40,50 * * * * /bin/bash -l -c 'cd /home/akram/RoR/f &&
script/rails runner -e production '\''User.weekly_update'\'''
i tried to change the environment by whenever --set
environment=development and then did whenever --update-crontab f
when i tried to see if the crontab job was written correctly crontab -
l gave me the same information again i.e
0,10,20,30,40,50 * * * * /bin/bash -l -c 'cd /home/akram/RoR/f &&
script/rails runner -e production '\''User.weekly_update'\'''
Thanks,
/bin/bash -l -c 'cd /home/akram/RoR/f && script/rails runner -e production '\''User.weekly_update'\'''
Access denied for user 'production'@'localhost' (using password: YES)
(Mysql2::Error)
This is well out of the realm of Whenever now so good luck!
-Javan
Thanks for your help
Akram
when i change the environment to development and run the same command
/bin/bash -l -c 'cd /home/akram/RoR/f && script/rails runner -e
development '\''User.weekly_update'\'''
I am able to get the mail.
def self.mail_recap_semaine
@user = User.all
@user.each do |u|
UserMailer.mail_recap_semaine(u.email).deliver
end
enddef mail_recap_semaine(email)
mail(:to => email, :subject => "Weekly email from footyaddicts")
endevery 10.minutes do
runner "User.mail_recap_semaine"
end# Begin Whenever generated tasks for: miiaou
0,10,20,30,40,50 * * * * /bin/bash -l -c 'cd /home/miiaou/miiaou && script/rails runner -e production '\''User.mail_recap_semaine'\'''
# End Whenever generated tasks for: miiaou
/bin/bash -l -c 'cd /home/miiaou/miiaou && script/rails runner -e production '\''User.mail_recap_semaine'\'''
/usr/bin/env: ruby.exe: Aucun fichier ou dossier de ce type (= no file or directory)
Ok.Stupid question, but what is the shebang, and how can I update it?
whenever --update-crontab appname --set environment=development, right?