Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

My sysadmin has set up a bunch of cron jobs on my machine. I'd like to know exactly what is scheduled for what time. How can I get that list?

share|improve this question
    
This isn't the answer to the question, but just a note on best practices. One can configure these as per-user cron jobs for root or apache or whatever, but one should use /etc/crontab or (better, in most distros) /etc/cron.d and /etc/cron.[timeframe]. –  mattdm Feb 8 '11 at 15:45
    
add comment

2 Answers 2

up vote 14 down vote accepted

Depending on how your linux system is set up, you can look in:

  • /var/spool/cron/* (user crontabs)
  • /etc/crontab (system-wide crontab)

also, many distros have:

  • /etc/cron.d/* These configurations have the same syntax as /etc/crontab

  • /etc/cron.hourly, /etc/cron.daily, /etc/cron.weekly, /etc/cron.monthly

These are simply directories that contain executables that are executed hourly, daily, weekly or monthly, per their directory name.

On top of that, you can have at jobs (check /var/spool/at/), anacron (/etc/anacrontab and /var/spool/anacron/) and probably others I'm forgetting.

share|improve this answer
1  
Thanks, I found them in /etc/cron.daily. How does that daily file work? What time will the daily jobs run? On my machine they seem to run around noon, but it'd like to tell my sysadmin how to change that to midnight instead. –  Frank Feb 7 '11 at 21:21
3  
cron.daily is called from /etc/crontab, e.g. on my Ubuntu system it's: 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) which means 6:25 am. –  Kowh Feb 8 '11 at 1:20
    
cron.daily is called from /etc/crontab on my RHEL5 system too, if you'd like more data points. –  jsbillings Feb 8 '11 at 13:34
    
On newer Fedora (and probably RHEL6 -- haven't looked yet), the cronie daemon takes care of those using the configuration in /etc/anacrontab. –  mattdm Feb 8 '11 at 15:48
    
Sometimes it's in /var/cron too. –  CMCDragonkai Jun 30 at 2:57
add comment

Probably depends on the crond you are using. For example, with Vixie-Cron (debian/ubuntu default) you get it for the current user via:

$ crontab -l

or for another user via

$ crontab -l -u juser

To get the crontabs for all users you can loop over all users and call this command.

Alternatively, you can look up the spool files. Usually, they are are saved under /var/spool/cron, e.g. for vcron following directory

/var/spool/cron/crontabs

contains all the configured crontabs of all users - except of the root user who is also able to configure jobs via the system-wide crontab, which is located at

/etc/crontab
share|improve this answer
    
Hm, down-vote ... - why? –  maxschlepzig Feb 7 '11 at 20:45
    
I didn't downvote. But I just tried crontab -l -u root (because those cronjobs I want to know about run under root), and it says I don't have privileges to use -u. –  Frank Feb 7 '11 at 21:00
    
Then you have to call it with enough privileges - i.e. as root user. –  maxschlepzig Feb 7 '11 at 21:02
    
Still not complete — some versions of cron run jobs from /etc/cron.d and /etc/cron.{daily,hourly,monthly,weekly} without a helper program called from /etc/crontab. –  mattdm Feb 8 '11 at 15:43
    
@mattdm, sure - thus the first sentence 'Probably depends on the crond you are using' - but looking at /etc/crontab you usually see references of /etc/cron.d, /etc/cron.daily etc. –  maxschlepzig Feb 8 '11 at 17:03
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.