LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 09: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 09:46 AM.
 
Old 11-18-2010, 01:10 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Happy scripting, I'll say.
 
Old 11-18-2010, 05: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: 332Reputation: 332Reputation: 332Reputation: 332
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, 04: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, 11:15 AM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 10:08 AM
All crontab jobs from all users booyeeka Linux - Newbie 2 08-18-2010 09:03 AM
saving crontab jobs wolfsar Linux - Software 4 07-15-2009 08:44 PM
Crontab not running jobs ncracraf Linux - Newbie 6 09-02-2006 03:44 PM
crontab jobs aren't running mdm_linux Linux - General 4 05-30-2005 01:27 PM


All times are GMT -5. The time now is 06:33 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration