javan / javan/whenever

Error when update crontab

Open
#766 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
8.9k
Forks
715
PR merge metrics
No merged PRs in 30d

Description

By executing the whenever --update-crontab command, the following error returns:

/usr/lib/ruby/vendor_ruby/whenever/cron.rb:132:in `parse_as_string': Couldn't parse: 31557600 (ArgumentError)
	from /usr/lib/ruby/vendor_ruby/whenever/cron.rb:112:in `parse_time'
	from /usr/lib/ruby/vendor_ruby/whenever/cron.rb:50:in `time_in_cron_syntax'
	from /usr/lib/ruby/vendor_ruby/whenever/cron.rb:42:in `output'
	from /usr/lib/ruby/vendor_ruby/whenever/cron.rb:36:in `block (2 levels) in output'
	from /usr/lib/ruby/vendor_ruby/whenever/cron.rb:35:in `each'
	from /usr/lib/ruby/vendor_ruby/whenever/cron.rb:35:in `block in output'
	from /usr/lib/ruby/vendor_ruby/whenever/cron.rb:34:in `each'
	from /usr/lib/ruby/vendor_ruby/whenever/cron.rb:34:in `output'
	from /usr/lib/ruby/vendor_ruby/whenever/job_list.rb:151:in `block (2 levels) in cron_jobs'
	from /usr/lib/ruby/vendor_ruby/whenever/job_list.rb:147:in `each'
	from /usr/lib/ruby/vendor_ruby/whenever/job_list.rb:147:in `block in cron_jobs'
	from /usr/lib/ruby/vendor_ruby/whenever/job_list.rb:146:in `each'
	from /usr/lib/ruby/vendor_ruby/whenever/job_list.rb:146:in `cron_jobs'
	from /usr/lib/ruby/vendor_ruby/whenever/job_list.rb:65:in `generate_cron_output'
	from /usr/lib/ruby/vendor_ruby/whenever.rb:10:in `cron'
	from /usr/lib/ruby/vendor_ruby/whenever/command_line.rb:54:in `whenever_cron'
	from /usr/lib/ruby/vendor_ruby/whenever/command_line.rb:106:in `updated_crontab'
	from /usr/lib/ruby/vendor_ruby/whenever/command_line.rb:35:in `run'
	from /usr/lib/ruby/vendor_ruby/whenever/command_line.rb:6:in `execute'
	from /usr/bin/whenever:41:in `<main>'

My schedule.rb file:

every 1.year do
  rake "maintenances:renew"
end

Any ideas?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the shown schedule.rb entry and whenever --update-crontab. Start in whenever/cron.rb at parse_time and parse_as_string, following the stack trace from the command-line entry point; done means a yearly schedule using 1.year generates crontab output without the parse error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.