How to see every cron job that's running
Understanding what cron jobs are running can be helpful when auditing jobs or resolving system resource issues. Luckily you can do this with a single command, and this quick guide will show you how.
How can you see all the jobs currently running?
To view all running cron jobs, list every process started by the cron daemon:
ps h --ppid $(pgrep cron)
This one-liner works because in the background when crond
runs a scheduled job, it makes an operating system exec
call to start a new process, and as a result, all running cron jobs are created as child processes of crond
.
If you are a Cronitor user, you can see all currently running jobs across all of your hosts from your Cronitor dashboard by clicking "Filters" and then selecting running jobs only.
Want alerts if your cron jobs stop working?
Tailing logs is better left to computers. Monitor your cron jobs with Cronitor to easily collect output, capture errors and alert you when something goes wrong.