Prerequisites
Before monitoring cron logs, make sure you have:
- SSH access to your VPS
View System Cron Logs
ssh hxroot@YOUR_SERVER_IP -p 22
grep CRON /var/log/syslog | tail -50
For Ubuntu 20.04+:
journalctl -u cron | tail -50
Check Cron Logs by Date
grep "Apr 29" /var/log/syslog | grep CRON
Monitor Cron Jobs Real-Time
tail -f /var/log/syslog | grep CRON
Check Log for Specific Command
grep "backup-script" /var/log/syslog
Redirect Cron Output to Log File
In your cron job, redirect output:
0 2 * * * /backup/script.sh >> /var/log/backup-cron.log 2>&1
Then view:
tail -f /var/log/backup-cron.log
Check if Cron Service is Running
systemctl status cron
Common Cron Issues
Cron job not running:
- Check cron service status
- Verify command has correct path (use full paths)
- Check permissions
- Test command manually:
sudo -u admin /usr/bin/php /home/admin/web/.../script.php
Environment variables missing: Add to cron job:
PATH=/usr/local/bin:/usr/bin:/bin
0 2 * * * /path/to/script
✅ You can now monitor cron job execution logs.