0

I am using whenever gem. I am calling runner to run job. I called runner for the same job by 3 type. I am not sure which one working here.

I used command whenever --update-crontab project_name then crontab -l

Schedule.rb

set :output, 'log/whenever.log'
every 1.days , :at => '03:51 pm' do 

 runner "SomeJob.perform_later", filename: '/app/jobs/some_job.rb'
end

every 1.days , :at => '03:51 pm' do
  runner "SomeJob.perform_later", filename: './app/jobs/some_job.rb'
end

every 1.days , :at => '03:51 pm' do
  runner "SomeJob.perform_later"
end

Also these ran only once. I am having difficult time to debug here.

Can anyone tell which one is correct? Also what is the correct way to debug in this scenario?

Running crontab -l gives me this -

51,51,51 16 * * * /bin/bash -l -c 'cd /home/rahul/orthoweb && bin/rails runner -e production '\''InvestigationStopJob.perform_later'\'' >> log/whenever.log 2>&1

To run in development environment I ran this command -

whenever --update-crontab --set environment='development'

But this gives me this message -

## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated.
vidal
  • 345
  • 3
  • 18

2 Answers2

1

There are some issues with running the jobs in development mode. What works is that you have to close all tabs before running your job and scheduler.

There is no need to change setup of your env in schedule file. To run in development use this

whenever --update-crontab --set environment='development'

Without specifying filename jobs does not run properly. The following line works correctly.

every 1.days , :at => '03:51 pm' do runner "SomeJob.perform_later", filename: '/app/jobs/some_job.rb' end

vidal
  • 345
  • 3
  • 18
0

I think, that the resulting crontab contains only one of those tasks, because they were overwritten.

To be sure, check out the resulting crontab by typing whenever. I think that there will be only one entrance.

maicher
  • 2,625
  • 2
  • 16
  • 27
  • I ran these tasks one by one also, but got no success. I ran `whenever ` also it didn't work. Do I need to run some thing else to run crontab in development? @maicher – vidal Sep 01 '16 at 10:51
  • Do you see any logs in your `log/whenever.log` file? If not, maybe CRON is not running. Furthermore you have to setup your env in schedule, see: http://stackoverflow.com/a/5879008/2933305 – maicher Sep 01 '16 at 10:57
  • 1
    Thanks for the respone. Solved the problem. It was a silly one – vidal Sep 01 '16 at 11:18