I have a relatively complex set of cron jobs running and it would be really useful for me to ask the system for the list of the next n cron tasks that will be performed.

So given a particular crontab i.e (copied and pasted from http://adminschoice.com/crontab-quick-reference).

30  0   1   1,6,12  *   A //00:30 Hrs  on 1st of Jan, June & Dec.
0   20  *   10  1-5     B //8.00 PM every weekday (Mon-Fri) only in Oct.
0   0   1,10,15 *   *   C //midnight on 1st ,10th & 15th of month
5   0   10  *   1       D At 12.10 every Monday & on 10th of every month

I could get back the list (assuming we start 31st May)

Cron jobs in queue:
B 2000 Tuesday
C 0000 Wednesday
B 8pm Wednesday
B 8pm Thursday

...ect.

Any ideas?

link|improve this question

feedback

1 Answer

up vote 1 down vote accepted

I'm afraid that's not too easy, because cron doesn't work that way, i.e. it does not create a "queue" of jobs to be run, but rather has the daemon check for jobs to be run every minute.

One would have to write a script to parse the crontab and rewrite the output. Just a matter of how much time you want to spend.

Here are some alternatives:

  • You can have a nice graphical representation of cronjobs with Gnome-schedule, because it also translates the crontabs into human readable strings:

    example

  • Here is a Server Fault question on a similar subject
  • Webmin has an interface for scheduling and editing cronjobs:

    example

  • There's also a small C# (?) project I found named crontabviewer.
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.