Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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.
share|improve this answer

Here's a blog post about a Perl script (croncal.pl) that parses crontabs and prints the dates and times of the invocations in a given time range (defaulting to 24 hours starting now).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .