MichaelXavier / cron

Cron data structure and parser for Haskell
Other
53 stars 33 forks source link

Add @reboot non-standard schedule #34

Closed chrislf closed 6 years ago

chrislf commented 6 years ago

Have you considered adding the @reboot schedule? Looking at the code it would be a bit intrusive, because it breaks the assumption that all @foo can be reduced to a timespec.

If I made a pull request, would you be interested in this?

MichaelXavier commented 6 years ago

Hi. I was vaguely aware of this directive but as you noted it really goes against every other aspect of cron which can boil down to a time interval. I don't think it is worth the amount of disruption you'd need in this library to have feature parity with popular cron implementations.

Generally speaking though, if you needed to write a cron replacement in Haskell and wanted to support @reboot, you could probably write a layer over this library's data structures that adds this oddball directive and puts the rest in another arm of the sum type. Then you could write a parser that parses the special case and falls back to parsing the rest. You'd reinvent far less of the wheel but you'd get the functionality. You could even publish that library if it made sense to. Hope that helps.

chrislf commented 6 years ago

Yes, I'd sort of ended up in the direction you describe while doing some exploratory coding, so that sounds like the best way forward. My goal is to write a crontab linter like chkcrontab; if I do manage to get anywhere with it I'll see if I can permission to publish it.

Thanks for the guidance!