Operating System - HP-UX
1819845 Members
2617 Online
109607 Solutions
New Discussion юеВ

List -all- cron scheduled jobs

 
SOLVED
Go to solution
Tom Gore
Regular Advisor

List -all- cron scheduled jobs

Is there a way to list -all- of the cron jobs? I know you can do it by user by user (crontab -l user), but is the a "wildcard" or something that will show all jobs by all users?

Thanks,
Tom
4 REPLIES 4
Patrick Wallek
Honored Contributor
Solution

Re: List -all- cron scheduled jobs

The only way to see ALL cron jobs is to do this while logged in as root:

# cat /var/spool/cron/crontabs/*
D. Jackson_1
Honored Contributor

Re: List -all- cron scheduled jobs

Tom -
I don't think you can do this with "crontab -l" But you can do this #> more /var/spool/cron/crontabs/*
This will give you what you need in HPUX 11.00 and 10.20 ....

HTH
Deshpande Prashant
Honored Contributor

Re: List -all- cron scheduled jobs

HI
You can use
#pg /var/spool/cron/crontabs/* to list all cronjobs
OR
for i in `cat /usr/lib/cron/cron.allow`
{
echo "For User {i} : "
crontab -l $i
}

Thanks.
Prashant.

Take it as it comes.
Steven Sim Kok Leong
Honored Contributor

Re: List -all- cron scheduled jobs

Hi,

I agree with Patrick.

Also, for ease of identification, you might also want to identify the cronjob you are listing:

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

Note also that scheduled jobs are usually by cron but they can be via at as well.

If you are looking for a rogue scheduled job, you might also want to list out files in atjobs ie.

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

Hope this helps. Regards.

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