How to check if a cron job is running
When you schedule a new cron job, or audit the existing jobs in a crontab file, one of the main questions you confront is whether the job is actually running or not. In this guide we will show you the logs and command line tools to figure that out.
How do you check if your job is running?
First, check your cron logs for clues. Cron jobs are run in the background by a process called crond. When it runs a job, it writes a few details to a system-level log file. Because these logs are written by crond itself, they will cover all jobs, across all crontab files. That centralization makes this the right place to start checking, but it does have a catch: If you can see your job invoked in the cron logs, it doesn't mean your job is healthy: there might still be bugs or environment issues that crash your process. But it does rule out a lot of possible failure scenarios. You will know that cron is running, your crontab is correct, file permissions are acceptable, you have the schedule right, and your command is at least being invoked.
The content and formatting of cron logs will vary across operating systems and distributions, but generally you will see an entry like this when a job is run:
Nov 29 16:15:01 data-processing CRON[12624]: (dataproc) CMD (/home/data-archiver.py)
Ubuntu (and Debian with rsyslog) write these lines to /var/log/syslog. Red Hat and CentOS write them to /var/log/cron. If this host logs to the systemd journal, or you are on macOS, the paths are in where cron logs are stored. Figure out which file you have before you continue.
If the job is monitored with Cronitor, each run's output and exit code are on the job page under Latest Activity. That is the command's own output, not the syslog line cron writes. Job monitoring is where that capture is configured.
A note about log rotation
System log files that could accrue indefinitely are usually managed by a log rotation process to keep them from filling disks and growing to unusable dimensions. The packaged logrotate job on Debian, Ubuntu, and RHEL runs once a day (itself from cron, or from a daily systemd timer). A host can be configured differently. Even a job that runs every 15 minutes can be missing from the current file if you look just after rotation. The lines you want may be in the file that was just rotated.
Rotated files stay in the same directory as the live log. On Debian and Ubuntu the newest copy usually ends in .1. Ubuntu's packaged /var/log/syslog rotation is weekly and delays compression by one cycle, so syslog.1 is plain text and the older copies (syslog.2.gz and on) need zgrep. Red Hat's default logrotate config names files by date (dateext), so the rotated cron log looks like cron-20261004 rather than cron.1.
A little trick is to just check the first line of the current file so you are aware of when it was last rotated:
$ head /var/log/syslog
Nov 29 00:00:02 ip-10-0-1-169 ntpd[3112716]: Soliciting pool server
Grepping the Logs
To find a job in the cron logs, you will need to match by the job command itself. First, view the crontab so you can copy the value exactly.
$ crontab -l
*/15 * * * * python /home/data-archiver.py
Next, copy the command and grep the cron log you identified in the previous step. Note: this will usually require root or sudo privileges.
$ grep "/home/data-archiver.py" /var/log/syslog
Nov 29 15:01:01 data-processing CRON[12624]: (dataproc) CMD (python /home/data-archiver.py)
Nov 29 15:15:01 data-processing CRON[14554]: (dataproc) CMD (python /home/data-archiver.py)
Nov 29 15:30:01 data-processing CRON[15101]: (dataproc) CMD (python /home/data-archiver.py)
Nov 29 15:45:02 data-processing CRON[15995]: (dataproc) CMD (python /home/data-archiver.py)
Nov 29 16:00:01 data-processing CRON[17017]: (dataproc) CMD (python /home/data-archiver.py)
Nov 29 16:15:01 data-processing CRON[17998]: (dataproc) CMD (python /home/data-archiver.py)
Here, you can see the command running every 15 minutes as expected.
Want alerts if your cron jobs stop working?
Monitor your cron jobs with Cronitor to easily collect output, capture errors and alert you when something goes wrong.
How to check if your cron job is running right now
Sometimes you will want to know if a cron job is running right now. This might be because you are expecting that your job should be running and you just want to check, or it might be because you know that your job should not be running right now and you want to rule out the possibility. In either case, you will use the ps command.
$ ps aux | grep "/home/data-archiver.py" | grep -wv grep
$
In this example, the job is not currently running. If it is running you will see an output like this:
$ ps aux | grep "/home/data-archiver.py" | grep -wv grep
dataproc 3301559 0.0 0.4 347308 133072 ? Sl Nov29 149:41 python /home/data-archiver.py
If you see more than one line, treat that as a yellow flag that there is something to investigate with this job. There are three common reasons you might see overlapping cron job executions:
- The job is inadvertently scheduled in more than one crontab file. This can create a real crunch on shared resources like databases and APIs.
- The job is hanging when it runs and not exiting cleanly. This might mean the job is not completing successfully.
- The job is running normally but takes longer to complete than the scheduled interval between job invocations.
A one-line list of the cron jobs that are still running is in how to see every cron job that's running.
If you are a Cronitor user, open Filters on the jobs list and choose Only next to Running. A running job card shows a blue Running label. The job page shows Running Now, and the timeline uses the same blue for a run still in progress. The monitors API accepts that state as well: GET /api/monitors?type=job&state=running. The query parameters are in filtering and searching monitors.
What to do if your job is not running
There are many reasons your cron jobs might not be running. Work through the possibilities with our cron job debugging guide
See all currently running cron jobs
If you are casting a wider net when validating and auditing jobs, head over to our guide to see all running cron jobs
Automatic cron job monitoring
Staying on top of background jobs and validating that they are running as expected is a time-consuming task that's better left to an automated monitoring system. We created Cronitor to solve this problem. You can install CronitorCLI on a host and monitor all of your cron jobs in minutes. The commands are in using CronitorCLI.