9

Is there a way to "query" a crontab to find which cron jobs run at some arbitrary date/time, or during a certain range of times?

For example, determine which will be run at sometime between 14:00 and 16:00 today, will run next Saturday at 10:00, or run every Sunday?

There are a lot of jobs scheduled, so reading all the crontabs by hand isn't really an option.

  • one of the solution can be to make timestamps, and redirect it to your monitoring system, in that case you can make script/check that actually checks what is executed and when – klerk Jun 26 '14 at 20:02
  • @klerk:Timestamps?Where from the cronjobs?I can not modify them as they are too many and all don't belong to me but other users. – Jim Jun 26 '14 at 20:03
  • @klerk:I mean how does linux when it should run a job? Some how there exists some kind of code that can interpret the crontab entries.Right? – Jim Jun 26 '14 at 20:04
  • 2
    @klerk Seems perfectly clear. OP is trying to answer the question: "At 3pm tomorrow, which jobs will crond run?" and several variants on that theme. – derobert Jun 26 '14 at 20:14
  • 1
    @Jim You might find what you want here: stackoverflow.com/a/137173/2100043 - From there you just need to get creative with you command line filtering tools. – BriGuy Jun 26 '14 at 20:22
2

I found this tool called cronviz which will show you a graphical representation of your crontab entries.

excerpt

You have a problem: something's causing performance issues on the application server between 1 and 4 AM, and the cron jobs seem a likely culprit.

Naturally, you eyeball your crontab to find out what's running during those hours.

Now you have two problems.

Over time, cron jobs accrete into an impenetrable, opaque mass of text. Trying to get a comprehensive sense of all the various run times, and finding patterns therein, can be exceedingly difficult. Crontabs are written for computers to interpret -- not humans.

Example screenshot

    ss #1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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