-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cron function not working #629
Comments
Please define "not working". Without such a definition (include cron logs at least) it is impossible to help you. |
Hi, I have used following code for send mail, every 1.hours do
rake 'dailymail:email_sender'
end in lib/tasks/dailymail.rake namespace :dailymail do
desc "Send email to users"
task :email_sender => :environment do
Member.all.each do |members|
DailyemailMailer.dailymail.deliver
end
end
end in app/mailers/dailyemail_mailer.rb class DailyemailMailer < ActionMailer::Base
default from: 'support@tradenaira.com'
def dailymail(member)
mail to: member.email, subject: 'TradeNAIRA daily rates update'
end
end When I enter the
What should I do ? |
Please confirm the following:
|
Please help me. |
Please find out. I can't help you otherwise.
What OS are you using? Could you perhaps consult its documentation to find your cron log?
I don't understand. It does or does not work? Is there any difference in the generated crontab? |
I am using Ubuntu server. And when i enter the "whereis cron.log" in terminal It should be displays : It's not working. It is working only when i enter in terminal like the command "bundle exec rake 'dailymail:email_sender'". |
You might want to look into explicitly logging your cron jobs and remove the --silent option to get more verbose output. Also try looking in |
Isn't this is code issue? Looks like,
accepts member object & you are not passing that one from rake task. Instead having code
should be
Try to look at the logs, you can see the error else execute below on rails console to see the error
|
Yes. I have missed the code the your pointed out on my second chatting in this loop. But on my code i have correctly do it. Like as DailyemailMailer.dailymail(member).deliver |
Hi @benlangfeld, Yes. I am checked on the your specified path /var/log/syslog. In that my cron is displayed. But mail is not receiving What should I do? Please help me |
Hi All, I am using following line for that in schedule.rb. It's working fine env :PATH, ENV['PATH'] |
Still issue is not solved! after adding path in schedule.rb file |
Hi All,
I use whenever gem but the cron job is not working for me on ubuntu production server. I used following command for every 2 minutes send the mail
02 * * * * /bin/bash -l -c 'cd /root/peatio/current && RAILS_ENV=production && bundle exec rake dailymail:email_sender --silent'
The text was updated successfully, but these errors were encountered: