Check Cron Job Execution History and Logs on Linux
Check Cron Job Execution History and Logs on Linux
Just need to find every job on the server? See how to list all cron jobs in Linux - all users, /etc/cron.d and systemd timers.
Need to check cron job execution history on your Linux server? Want to monitor cron job execution, track execution logs, and detect failed executions? This guide shows you how to check cron job execution history using built-in commands and automated monitoring with Zuzia.app.
For comprehensive cron monitoring strategies, see Cron Jobs & Scheduled Tasks Monitoring. For troubleshooting cron issues, see Cron Jobs Not Executing.
Why Checking Cron Execution History Matters
Cron jobs execute scheduled tasks automatically. When cron jobs fail to execute or execute incorrectly, critical tasks can be missed, backups can fail, and maintenance operations can be skipped. Checking cron execution history helps you verify jobs execute successfully, track execution patterns, detect execution failures, and maintain task reliability.
Method 1: View Cron Execution Logs
View cron execution logs to see job execution history:
Check System Cron Logs
# View cron execution logs
grep CRON /var/log/syslog
# View recent cron executions
grep CRON /var/log/syslog | tail -50
# View cron executions for specific user
grep CRON /var/log/syslog | grep username
# View cron executions by date
grep CRON /var/log/syslog | grep "$(date +%b\ %d)"
Monitor Cron Job Output
# Check for cron job errors
grep CRON /var/log/syslog | grep -i "error\|fail"
# View cron job execution times
grep CRON /var/log/syslog | awk '{print $1, $2, $3, $6, $7, $8}'
# Monitor cron executions in real-time
tail -f /var/log/syslog | grep CRON
Method 2: Track Specific Cron Jobs
Track specific cron jobs to verify they execute:
Check Job Execution
# Check if specific job executed recently
grep "job-name" /var/log/syslog | tail -5
# Verify job execution time
grep "job-name" /var/log/syslog | grep "$(date +%b\ %d)" | tail -1
# Check job execution frequency
grep "job-name" /var/log/syslog | wc -l
# View job execution history
grep "backup-script" /var/log/syslog | tail -20
Monitor Job Success
# Check for successful job executions
grep "job-name" /var/log/syslog | grep -i "success\|complete"
# View job execution errors
grep "job-name" /var/log/syslog | grep -i "error\|fail"
# Check job exit codes
grep "job-name" /var/log/syslog | grep -E "exit [1-9]"
Method 3: Detect Execution Failures
Detect execution failures to identify problematic jobs:
Identify Failed Executions
# Check for cron execution errors
grep CRON /var/log/syslog | grep -i "error\|fail\|exit"
# View jobs with non-zero exit codes
grep CRON /var/log/syslog | grep -v "exit 0"
# Check for missed executions
grep CRON /var/log/syslog | grep -i "missed\|skip"
# View cron job failures by user
grep CRON /var/log/syslog | grep -i "error\|fail" | awk '{print $6}' | sort | uniq -c
Monitor Execution Patterns
# Count cron executions per hour
grep CRON /var/log/syslog | awk '{print $3}' | cut -d: -f1 | sort | uniq -c
# View cron job execution frequency
grep CRON /var/log/syslog | awk '{print $6, $7, $8}' | sort | uniq -c
# Analyze cron job timing patterns
grep CRON /var/log/syslog | awk '{print $3}' | sort | uniq -c
Method 4: Automated Cron History Monitoring with Zuzia.app
Manual checks work while you are looking. To keep running them without you, Zuzia uses its agent and scheduled tasks.
How it works in Zuzia
- Install the Zuzia agent on the server with one command. CPU, RAM, disk, load and network metrics start reporting on their own, with alerts on a threshold, on drift from the server's normal, or on a disk fill-up forecast.
- Save the commands from this guide as a scheduled task and choose how often it runs, from every minute to once a year. The agent runs it on every host you pick.
- If a command fails, you get an alert right away by email, Slack, Discord, push (through your Pushover account) or SMS (through your Vonage account).
- The output of every run is kept, so you can look back at what changed. On paid plans, AI can read the output and alert you only when it spots a problem.
Setting it up
- Add the server in the Zuzia dashboard and install the agent.
- Create a scheduled task with the check commands below, then choose the hosts and how often it runs.
- Choose your notification channels. Turn on maintenance mode during planned work so it doesn't trigger alerts.
Custom Cron History Monitoring Commands
Add these commands as scheduled tasks:
# Check for cron execution errors
grep CRON /var/log/syslog | grep -i "error\|fail" | tail -10
# Verify critical job executed
grep "backup-script" /var/log/syslog | grep "$(date +%b\ %d)" | tail -1
# View recent cron executions
grep CRON /var/log/syslog | tail -20
Best Practices
1. Monitor Cron History Continuously
Use Zuzia.app for continuous cron history monitoring. Set up alerts before execution issues become critical. Review execution logs regularly.
2. Track Critical Jobs
Focus monitoring on business-critical tasks. Set up dedicated monitoring for critical jobs. Configure immediate alerts for critical job failures.
3. Verify Job Success
Don't just check if jobs run. Verify job exit codes. Check job output for errors. Validate job results.
Troubleshooting
Job Not Executing
When jobs don't execute:
- Check cron service:
systemctl status cron - Verify cron job syntax:
crontab -l - Check execution logs:
grep CRON /var/log/syslog | tail -20
Job Execution Failures
When jobs fail:
- Review execution logs:
grep "job-name" /var/log/syslog | tail -20 - Check job output:
grep "job-name" /var/log/syslog | grep -i "error\|fail" - Test job manually: Run job command directly
FAQ
How often should I check cron execution history?
For production servers, check cron history every 10-15 minutes. Zuzia.app can check history automatically and alert when execution issues are detected.
What cron jobs should I monitor?
Monitor all production cron jobs, especially critical tasks like backups, database maintenance, and reports.
Can Zuzia.app detect cron execution failures automatically?
Yes, Zuzia.app can detect execution failures by monitoring cron logs, checking for error messages, verifying job execution, and alerting when jobs fail.
Related guides, recipes, and problems
Related guides
Related recipes
Related problems