cron icon indicating copy to clipboard operation
cron copied to clipboard

Unable to parse a range (strconv.Atoi error)

Open dma156 opened this issue 7 years ago • 4 comments

I am getting this error

failed to parse int from 1-4: strconv.Atoi: parsing "1-4": invalid syntax

from the cron string "*/1-4 * * * *"

Please let me know if this is just me being stupid or a bug. Because afaik ranges should be supported as a hyphen is an accepted character.

dma156 avatar Oct 07 '19 16:10 dma156

I believe ranges are not expected as the divisor, but they definitely work prior to the slash. The error handling could probably be better. What schedule are you trying to create?

Refer here to Slash usage: https://en.wikipedia.org/wiki/Cron

robfig avatar Oct 07 '19 17:10 robfig

I'm trying to create this schedule here. https://cronexpressiondescriptor.azurewebsites.net/?expression=%2F1-4++++*&locale=en

Running a job every 1-4 minutes. Though on closer inspection this isn't what I need anyway. But currently you don't support ranges as the divisor?

dma156 avatar Oct 08 '19 09:10 dma156

Do you mean running a job each minute on minutes 1-4 of each hour? That would be "1-4", not "*/1-4".

Otherwise, that schedule doesn't make sense to me.. To take the first element in the range: let's say you run a job every 1 minute. Now we take the second element of the range, 2. How does that change the schedule?

robfig avatar Nov 19 '19 17:11 robfig

Sorry for leaving this open. I believe I was trying to have a job run at intervals of 1,2,3, or 4 minutes. That is my best guess. Not sure if cron even supports such a thing? I've been (possibly incorrectly) relying on this website https://cronexpressiondescriptor.azurewebsites.net/?expression=%2F1-4++++*&locale=en for cron descriptions.

Either way I have no need to do this anymore and you can consider this a user error. Thanks for your time.

dma156 avatar Dec 06 '19 17:12 dma156