Incorrect crontab generated when using "days after/before"
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 8.9k
- Forks
- 715
- PR merge metrics
- No merged PRs in 30d
Description
Chronic correctly parses the following:
> Chronic.parse('4 days after start of month at 1pm')
=> 2021-10-05 13:00:00 +0200
However, the crontab the following generates:
every 1.month, at: '4 days after start of month at 1pm' do
rake "execute_some_task"
end
Is incorrect:
0 13 1 * * /bin/bash -l -c 'cd /home/path/to/project && RAILS_ENV=development bundle exec rake execute_some_task --silent'
As it schedules the job for the 1st day of every month instead.
- This example is just to simplify the issue for illustrative purposes, in reality I'm attempting to have the job run 4 days before the end of the month, but that comes with its own nuances.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue from the Whenever DSL example using “4 days after start of month at 1pm,” then compare its generated crontab with Chronic.parse's result. Trace how the DSL expression becomes the cron day-of-month field; done means the generated schedule runs four days after the month's start rather than on the first, with the end-of-month case considered separately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100