How can get a list of all scheduled cron jobs on my machine?
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?
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]`.
I have posted a script which automates this to a useful degree at: - https://stackoverflow.com/questions/134906/how-do-i-list-all-cron-jobs-for-all-users/53892185#53892185 It's not perfect but probably covers 90% of the needs. It is a good example of what not to write in bash.
Depending on how your linux system is set up, you can look in:
also, many distros have:
/etc/cron.d/*These configurations have the same syntax as
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 (
/var/spool/anacron/*) and probably others I'm forgetting.
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.
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.
cron.daily is called from /etc/crontab on my RHEL5 system too, if you'd like more data points.
On newer Fedora (and probably RHEL6 -- haven't looked yet), the `cronie` daemon takes care of those using the configuration in `/etc/anacrontab`.