Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to list all cron jobs.

Status
Not open for further replies.

TeleBOYWONDER

IS-IT--Management
Nov 8, 2002
82
US
Hi
I need to list all cron jobs for a specific time frame like today between 2pm and 3pm?
Basically I have a script(somewhere) running that adds a menu to an appliaction running on the box. However when the secondary menu is selected and one of the options is to run a report, the job dies:

"Creating Reports Please Wait............................................
....
Sending report(s) to server(s).
/export/home/pserv/k12/january[20]: 3057 Killed
06/22/04"


Thanks in advance for the help.
 
all of your cron jobs should be in /etc/crontab unless they are ones you specify in cron.d. I woul dcheck there to run that report.

___________________________________
[morse]--... ...--[/morse], Eric.
 
/var/spool/cron/crontab dir contains all user's crontabs.
see the files to find schedules...

-sbsaikia
 
If this is something that runs daily you can check /var/cron/log or /var/cron/olog for history. That may give you some insight into what is happening.

HTH
Brian
 
TeleBOYWONDER.

you can get the current crontab list by
executing the command below :

crontab -l

to edit the current list, you can use the
command below :

crontab -e

hope it helps.

Don Andres Pascual (Japan)
 
It's generally not considered good practice to edit the current crontab file directly using crontab -e. Instead make a copy of it, edit that and make sure it looks OK syntactically, then replace the existing crontab using crontab <newfilename>.
 
Hi TeleBOYWONDER,
Lots of very good advice, but no-one has actually answered your question:
>>> I need to list all cron jobs for a specific time frame like today between 2pm and 3pm?

How about this (note the spaces are very important between the quotes for the grep command):
for Username in `ls /var/spool/cron/crontabs`
do
echo "Crontab owner: $Username"
cat /var/spool/cron/crontabs/$Username | grep -v "^#" | grep "^.* 14 "
echo "---------------------------------------------------------"
done

A bit crude in pulling out all jobs that run 14:00 to 14:59 because it will also find jobs that are to run on the 14th of the month (or that are passed a parameter of 14).

Anyway, I hope it helps you.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top