Cron notation not working on production server

57 views
Skip to first unread message

jan javinto

unread,
Oct 18, 2017, 4:38:35 PM10/18/17
to Rufus Ruby
I'm using Sidekiq-cron in a Rails 5.1 application. I'm having jobs loaded via the config/schedule.yml file.

Until about two months ago this cron-job was perfectly working:

 
send_evaluation_message_job:
   
# Every whole hour between 9am and 8pm, except sundays
    cron
: "0 9-20 * * 1-6"
   
class: "SendEvaluationMessageJob"



Now it's not anymore and I cannot figure out why. More remarkbly it's working locally on my machine, but not on my server in production mode!

When I change the cron notation to something like "0 * * * * *" then the job gets queued. Manually queueing the job works fine too.

What's wrong with this 0 9-20 * * 1-6 notation?

These are the gems I'm using:

* actioncable (5.1.4)
  * actionmailer (5.1.4)
  * actionpack (5.1.4)
  * actionview (5.1.4)
  * activejob (5.1.4)
  * activemodel (5.1.4)
  * activerecord (5.1.4)
  * activesupport (5.1.4)
  * acts_as_list (0.9.7)
  * airbrussh (1.3.0)
  * arel (8.0.0)
  * autoprefixer-rails (7.1.4)
  * bindex (0.5.0)
  * bootstrap (4.0.0.beta)
  * builder (3.2.3)
  * bundler (1.15.4)
  * byebug (9.1.0)
  * capistrano (3.9.1)
  * capistrano-bundler (1.2.0)
  * capistrano-passenger (0.2.0)
  * capistrano-rails (1.3.0)
  * capistrano-rvm (0.1.2)
  * capistrano-sidekiq (0.20.0)
  * climate_control (0.2.0)
  * cocaine (0.5.8)
  * coffee-rails (4.2.2)
  * coffee-script (2.4.1)
  * coffee-script-source (1.12.2)
  * concurrent-ruby (1.0.5)
  * connection_pool (2.2.1)
  * domain_name (0.5.20170404)
  * erubi (1.6.1)
  * et-orbi (1.0.5)
  * exception_notification (4.2.2)
  * execjs (2.7.0)
  * ffi (1.9.18)
  * friendly_id (5.1.0)
  * globalid (0.4.0)
  * haml (5.0.3)
  * http-cookie (1.0.3)
  * i18n (0.8.6)
  * jbuilder (2.7.0)
  * jquery-rails (4.3.1)
  * json (2.1.0)
  * libv8 (3.16.14.19)
  * listen (3.1.5)
  * loofah (2.0.3)
  * mail (2.6.6)
  * method_source (0.8.2)
  * mime-types (3.1)
  * mime-types-data (3.2016.0521)
  * mimemagic (0.3.2)
  * mini_portile2 (2.2.0)
  * minitest (5.10.3)
  * multi_json (1.12.2)
  * mysql2 (0.4.9)
  * net-scp (1.2.1)
  * net-ssh (4.2.0)
  * netrc (0.11.0)
  * nio4r (2.1.0)
  * nokogiri (1.8.0)
  * paperclip (5.1.0)
  * popper_js (1.11.1)
  * puma (3.10.0)
  * rack (2.0.3)
  * rack-protection (2.0.0)
  * rack-test (0.7.0)
  * rails (5.1.4)
  * rails-dom-testing (2.0.3)
  * rails-html-sanitizer (1.0.3)
  * rails_real_favicon (0.0.7)
  * railties (5.1.4)
  * rake (12.1.0)
  * rb-fsevent (0.10.2)
  * rb-inotify (0.9.10)
  * redis (4.0.1)
  * ref (2.0.0)
  * responders (2.4.0)
  * rest-client (2.0.2)
  * ruby_dep (1.5.0)
  * rubyzip (1.2.1)
  * rufus-scheduler (3.4.2)
  * sass (3.5.1)
  * sass-listen (4.0.0)
  * sass-rails (5.0.6)
  * sidekiq (5.0.5)
  * sidekiq-cron (0.6.3)
  * simple_form (3.5.0)
  * spring (2.0.2)
  * spring-watcher-listen (2.0.1)
  * sprockets (3.7.1)
  * sprockets-rails (3.2.1)
  * sqlite3 (1.3.13)
  * sshkit (1.14.0)
  * temple (0.8.0)
  * therubyracer (0.12.3)
  * thor (0.20.0)
  * thread_safe (0.3.6)
  * tilt (2.0.8)
  * tzinfo (1.2.3)
  * uglifier (3.2.0)
  * unf (0.1.4)
  * unf_ext (0.0.7.4)
  * web-console (3.5.1)
  * websocket-driver (0.6.5)
  * websocket-extensions (0.1.2)

John Mettraux

unread,
Oct 18, 2017, 4:51:23 PM10/18/17
to rufus...@googlegroups.com

On Wed, Oct 18, 2017 at 08:18:09AM -0700, jan javinto wrote:
>
> I'm using Sidekiq-cron in a Rails 5.1 application. I'm having jobs loaded
> via the config/schedule.yml file.

Hello,

I'll try to help, although I'm not the author of Sidekiq-cron, merely the
author of rufus-scheduler.

> Until about two months ago this cron-job was perfectly working:
>
> ```yaml
> send_evaluation_message_job:
> # Every whole hour between 9am and 8pm, except sundays
> cron: "0 9-20 * * 1-6"
> class: "SendEvaluationMessageJob"
> ```
>
> Now it's not anymore and I cannot figure out why.
> More remarkbly it's working locally on my machine, but not on my
> server in production mode!

A first step would be to figure out what changed between "two months ago" and
now. Which gems got added? Which gems got added?

By the way, what server are you running Rails on? Thin, Unicorn, Passenger?
What Ruby version? What operating system? Linux? Debian or CentOS? FreeBSD?
...

What changed?


> When I change the cron notation to something like "0 * * * * *" then the
> job gets queued. Manually queueing the job works fine too.
>
> What's wrong with this 0 9-20 * * 1-6 *notation?

Is there anything in the log getting written when those unsuccessful jobs get
scheduled?

Is there anything in the log getting written when those unsuccessful jobs are
suppose to trigger?

Did you write a small test case that reproduces the issue from the command
line on the server machine?


> These are the gems I'm using:
>
> (...)
> * et-orbi (1.0.5)
> (...)
> * rufus-scheduler (3.4.2)
> (...)

OK.

A tiny thing you could try is to upgrade et-orbi to the latest, 1.0.7, and
try again. Tell me what happens then.


Best regards,

John

Reply all
Reply to author
Forward
0 new messages