Skip to content
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

Couldn't parse cron string #768

Closed
thestelz opened this issue Jan 31, 2019 · 1 comment
Closed

Couldn't parse cron string #768

thestelz opened this issue Jan 31, 2019 · 1 comment

Comments

@thestelz
Copy link

We just updated to rails 5.2.2 and ruby 2.5.3 from rails 4.1.7 and ruby 2.1.2. When the whenever --update-crontab command is ran, we get the following error:

$ whenever --update-crontab
Traceback (most recent call last):
	24: from /home/ubuntu/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
	23: from /home/ubuntu/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
	22: from /home/ubuntu/.rvm/gems/ruby-2.5.3/bin/whenever:23:in `<main>'
	21: from /home/ubuntu/.rvm/gems/ruby-2.5.3/bin/whenever:23:in `load'
	20: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/bin/whenever:44:in `<top (required)>'
	19: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/command_line.rb:6:in `execute'
	18: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/command_line.rb:38:in `run'
	17: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/command_line.rb:111:in `updated_crontab'
	16: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/command_line.rb:57:in `whenever_cron'
	15: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever.rb:12:in `cron'
	14: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/job_list.rb:75:in `generate_cron_output'
	13: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/job_list.rb:165:in `cron_jobs'
	12: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/job_list.rb:165:in `each'
	11: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/job_list.rb:166:in `block in cron_jobs'
	10: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/job_list.rb:141:in `cron_jobs_of_time'
	 9: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/job_list.rb:141:in `each'
	 8: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/job_list.rb:145:in `block in cron_jobs_of_time'
	 7: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/cron.rb:38:in `output'
	 6: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/cron.rb:38:in `each'
	 5: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/cron.rb:39:in `block in output'
	 4: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/cron.rb:39:in `each'
	 3: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/cron.rb:40:in `block (2 levels) in output'
	 2: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/cron.rb:46:in `output'
	 1: from /home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/cron.rb:54:in `time_in_cron_syntax'
/home/ubuntu/.rvm/gems/ruby-2.5.3/gems/whenever-0.10.0/lib/whenever/cron.rb:154:in `parse_as_string': Couldn't parse: 0 2 20 3 (ArgumentError)

The line that it's failing on is:

every '0 2 20 3,6,9,12 * ' do
    rake 'db:generate_new_quarter'
end

We haven't changed that line since 2013. Is there something that we need to configure on our end or is this a bug?

Not sure if this is a duplicate of #766, so I created a new issue instead. Figured you guys would know best.

Thanks!

@thestelz
Copy link
Author

thestelz commented Feb 1, 2019

Even tho the line hasn't changed since 2013, removing any trailing spaces fixed the issue.

-every '0 2 20 3,6,9,12 * ' do
+every '0 2 20 3,6,9,12 *' do

Closing this, but not sure if something changed in ruby or rails to start causing this to fail.

@thestelz thestelz closed this as completed Feb 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant