Operating System - HP-UX
1825051 Members
3405 Online
109678 Solutions
New Discussion юеВ

Re: List of -all- scheduled cron jobs.

 
SOLVED
Go to solution
Tom Gore
Regular Advisor

List of -all- scheduled cron jobs.

How can I obtain a list of -all- scheduled cron jobs? I know I can get it user by user (crontab -l user), but is there some "wildcard" or something that will let me view all jobs?

Thanks,
Tom

Sorry if this is posted twice. I sent it yesterday, but cannot find any trace of it today.
7 REPLIES 7
Alan Casey
Trusted Contributor
Solution

Re: List of -all- scheduled cron jobs.

cat /var/spool/cron/crontabs/*

All the crontabs are held in this directory.
harry d brown jr
Honored Contributor

Re: List of -all- scheduled cron jobs.

If this file is in play: /usr/lib/cron/cron.allow, then you know and control what users have access to cron.

live free or die
harry
Live Free or Die
Uday_S_Ankolekar
Honored Contributor

Re: List of -all- scheduled cron jobs.

Hi,

all the cronjobs are resided in this directory.
/var/spool/cron/crontabs

There will be different files for each cron jobs by user id.

-USA..
Good Luck..
Sridhar Bhaskarla
Honored Contributor

Re: List of -all- scheduled cron jobs.

There is no default command that will give you a list of all the users and their cronjobs. But you can write few commands as a script to get what you want. As a root user

#!/usr/bin/ksh

CRONTABS=/var/spool/cron/crontabs
for USER in `ls $CRONTABS`
do
echo "$USER: "
grep -v "^#" $USER
echo ""
done


Executing this script will give you crontab entries by user.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Steven Sim Kok Leong
Honored Contributor

Re: List of -all- scheduled cron jobs.

Hi,

Your previous posting is still out there. You can check your last posts in your user profile on the left column.

Anyway, if you are looking at scheduled jobs, don't forget at jobs as well.

To list at jobs, run
# cat /var/spool/cron/atjobs/*

In fact, for ease of identification, you can wrap both in echo statements:

# for user in /var/spool/cron/crontabs/* /var/spool/cron/atjobs/* ; do echo $user cron/at job ; cat $user ; done

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
Helen French
Honored Contributor

Re: List of -all- scheduled cron jobs.

hey,

have a look at the /var/spool/cron directory. You can find all cron job files in 'crontabs' directory. Also you can find all 'at' jobs in 'atjobs' directory.

Shiju
Life is a promise, fulfill it!
Sridhar Bhaskarla
Honored Contributor

Re: List of -all- scheduled cron jobs.

A small correction in my message...

please replace grep -v "^#" $USER as

grep -v "^#" ${CRONTABS}/${USER}

-Sri

You may be disappointed if you fail, but you are doomed if you don't try