LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-18-2010, 08:32 AM   #1
batfastad
Member
 
Registered: Nov 2004
Location: London, UK
Distribution: CentOS, RHEL, Debian, IPCop, PS2Linux
Posts: 95

Rep: Reputation: 23
Question Crontab, show live timing/queue of upcoming jobs?


Hi everyone

Just wondering, is there a command or utility out there anywhere which can output a countdown of upcoming jobs from crontab?
So you can display the queue of tasks in the order that they'll next run.

Anything like this out there?

EDIT: I realise there's crontab -l but that just echoes out the contents of the crontab file. I'd like somehow to get a countdown.

Cheers, B

Last edited by batfastad; 11-18-2010 at 08:46 AM.
 
Old 11-18-2010, 12:10 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Happy scripting, I'll say.
 
Old 11-18-2010, 04:53 PM   #3
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Quote:
Originally Posted by batfastad View Post
Hi everyone

Just wondering, is there a command or utility out there anywhere which can output a countdown of upcoming jobs from crontab?
So you can display the queue of tasks in the order that they'll next run.

Anything like this out there?

EDIT: I realise there's crontab -l but that just echoes out the contents of the crontab file. I'd like somehow to get a countdown.

Cheers, B
The crontab file is the only evidence of job scheduling in the cron system. The cron utility reads the crontab files once every minute to see if any jobs are due to run. Therefore there is no system job queue for cron.

Your only option is to write a script to read the crontab files and create your own simulation of a job queue.
 
Old 11-19-2010, 03:07 AM   #4
batfastad
Member
 
Registered: Nov 2004
Location: London, UK
Distribution: CentOS, RHEL, Debian, IPCop, PS2Linux
Posts: 95

Original Poster
Rep: Reputation: 23
That's a shame, I just thought the OS would expose that info somewhere.
Don't think my bash scripting is up to that yet, might be able to knock something up in PHP though.

The problem I can see is if you use the */20 syntax to say eg: every 20 minutes.
Since it's not detailed in the crontab file at what point the first instance was run, so you don't know when the next 20 minutes starts/ends. Guess you'd have to parse the cron log for that to see what time that was last run.

In the meantime, I'll keep digging to see if someone's already been here!

Cheers anyway
B
 
Old 11-19-2010, 10:15 AM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by batfastad View Post
T

The problem I can see is if you use the */20 syntax to say eg: every 20 minutes.
Since it's not detailed in the crontab file at what point the first instance was run, so you don't know when the next 20 minutes starts/ends. Guess you'd have to parse the cron log for that to see what time that was last run.

Well actually - it's not quite that complicated. In the
*/X notation it always starts counting from the 0th element;
so if you had
Code:
*/5 * * * * something
it would first execute at
the closest hour, then at the HH:05, then HH:10 and so
forth, not at some arbitrary value depending on when
you saved the crontab file.


Cheers,
Tink
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I tell if crontab jobs are axecuting ? juanb Linux - General 4 01-27-2011 09:08 AM
All crontab jobs from all users booyeeka Linux - Newbie 2 08-18-2010 08:03 AM
saving crontab jobs wolfsar Linux - Software 4 07-15-2009 07:44 PM
Crontab not running jobs ncracraf Linux - Newbie 6 09-02-2006 02:44 PM
crontab jobs aren't running mdm_linux Linux - General 4 05-30-2005 12:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration