Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

crontab says "at this freq." and then gives two points, not a frequency #124

Closed
nospampleasemam opened this Issue · 27 comments

6 participants

@elohmrow

i can work on this next week if no one else is yet; just let me know.

@mintsoft
Collaborator

@elohmrow go for it!

@jagtalon
Owner

@elohmrow Nice--just ask us if you have any questions!

@elohmrow
@elohmrow

ok, i just took a look at this.

what exactly do we want it to do?

right now, the description says:
'show the next occurance of a cron job in human-readable form'

but then the output gives us a "frequency" along with the next N (where N has been hard-coded to be 3) occurrences.

if we want it to simply show the next N occurrences, then this is as simple as changing the output verbiage.

if we in stead want a human-readable frequency (e.g., "this job will run every 5 minutes on the 3rd friday of every month"), then there's more work here than 5 minutes.

i'll go whichever way is best - lemme know your thoughts!

@mintsoft
Collaborator

@elohmrow I think the problem is that it says "at this frequency" implying "every 5 minutes", but instead gives examples of the frequency.

Personally I think output like "Every 5 minutes starting at 00:02 (00:02, 00:07, 00:12...)" would be the ideal.

@nospampleasemam did you have anything particular in mind?

@moollaza
Owner

ping.

Any progress on this guys?

@moollaza moollaza removed the Improvement label
@elohmrow
@moollaza
Owner

@elohmrow I think your suggestion,

if we in stead want a human-readable frequency (e.g., "this job will run every 5 minutes on the 3rd friday of every month"), then there's more work here than 5 minutes.

sounds like the best idea as making the cron job human-readable and easy to understand seems to be the goal of this IA -- or at least that's what I would use it for :)

@elohmrow
@elohmrow

@moollaza - i managed to find some (huge) code for translating (what looks like) every cronfile version here: http://www.cpan.org/authors/id/S/SB/SBURKE/crontab2english_0.71.pl.

after making some minor changes, this seems to be what we would want:

bradley@li239-109:~/C2E$ cat cron1
* */3 * * * blah
bradley@li239-109:~/C2E$ ./c2e.pl cron1
This cron job will run: Every minute of every third hour of every day
bradley@li239-109:~/C2E$ cat cron2
42 12 3 Feb Sat blah
bradley@li239-109:~/C2E$ ./c2e.pl cron2
This cron job will run: 12:42pm on the third of -- or every Saturday in -- February
bradley@li239-109:~/C2E$

The issue is the (huge) bit. The author never converted this to a module, so it's this 1,000 line monster.

My thinking is this: I can modify this a bit more, then add this 1,000 lines to the existing script for now, then convert this cron2english script into a module, and later #include that and then remove that 1,000 lines from the goodie. This script seems to be very tight, and does a lot more (and more closely matches what we want to do with this goodie) than the previous include.

Thoughts?

@moollaza
Owner

@elohmrow that sounds like a good plan, good find!

I don't mind the Goodie being huge, but of course it's much cleaner if we can just use a module.

@elohmrow
@elohmrow

@moollaza had a chat with the author of that perl script after i proclaimed i'd do this ... he claims his work is not yet ready for prime time, and that it can be, but should not be used. he wants to run through it again at some point and make sure it meets all possible changes to cron files since he last looked at it.

IMO, what he has is far superior to what we currently are using, so ... i still plan to turn it into a module ... will do today, and then convert the goodie to use said module.

@elohmrow

@moollaza okey, this is working now locally, using a module. once the module is accepted up to CPAN, I will commit to DDG for use.

@moollaza
Owner

@elohmrow sorry for the delay -- this looks great, much simpler! Is ParseCron on CPAN now? Go ahead and make a PR if it is :)

Thanks again!

@elohmrow

@moollaza yes, you can do a cpan install ParseCron now. i'm pretty busy until this weekend, so i may not be able to open a PR until then.

@moollaza
Owner

@elohmrow excellent. That's no problem, there's no rush :)

@elohmrow

whatever happened to this?

doesn't look like it was pushed up yet.

@jagtalon
Owner

@elohmrow Nice! Please make a PR for it. :)

@elohmrow
@jagtalon
Owner

@elohmrow Thanks!

@elohmrow

@moollaza @jagtalon - PR submitted as #558

@jagtalon
Owner

@elohmrow I see! Reopen it if you're ready, :)

@W25

I wrote a parser for crontab format similar to crontab2english and the CPAN module ParseCron. Your comments and suggestions are welcomed. #885

@mintsoft
Collaborator

Fixed by @W25 in #885

@mintsoft mintsoft closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.