0

Hi I am using the whenever gem and trying to send a daily email. For testing I set it to 2 minutes, and I have it in my schedule.rb file. It calls a task I have in a rake file. When I run bundle exec rake task_to_be_called, it runs and works. But the actual scheduling does not work. When I try to run things to find out crontab it says no such file or directory. Is there some way to get a crontab file, or do I make it? How do I test or get my scheduler to run that task?

EDIT: Thanks for the advice on sharing code and error.

In my lib/tasks/daily_email.rake I have

 desc 'Daily email rake task test'
task daily_email_call: :environment do
ReportMailer.with(email: "email@email.com").daily_summary_report.deliver_now
end

Then in my config/schedule.rb I have

every 2.minute do
    rake 'daily_email_call'
  end

When I run bundle exec rake daily_email_call it functions correctly and does the send email task. My question is how to get it to do it on the schedule. I have no crontab file. Am I even able to do this locally or would it need to be on a running server. I am using windows not Linux when I run mine locally.

sephiroth
  • 83
  • 1
  • 10

1 Answers1

0

There is a typo in the file name,

lib/tasks/darily_email.rake => lib/tasks/daily_email.rake

I guess this is causing the error, no such file or directory

  • Oh thanks for the idea but no unfortunately that typo was just in my post describing it. The issue isn't with the rake job. Like I said I can call the job via console and it performs it correctly. I just don't understand how cron jobs work and getting the schedule working. I have no crontab. Any idea? The server is running in an azure docker configuration. Any idea how to run commands, I want to tell it to update crontab. But I don't know how to run command line, it just has you upload the built app. – sephiroth Aug 04 '21 at 14:48