Last updated
Tips for Reliable Scheduling
- Always use UTC on cloud servers to avoid daylight saving time issues
- Redirect cron output to a log file:
command >> /var/log/job.log 2>&1 - Use the generator's "Next execution times" preview before deploying
- Add a small random delay to avoid thundering herd when many jobs run at the same time
- Test your script manually before adding it to cron to ensure it works correctly
- Use absolute paths in cron commands — cron has a minimal PATH environment
Examples
Example 1: System Maintenance Tasks
# Nightly database backup at 2:00 AM
0 2 * * *
# Weekly full backup on Sunday at 1:00 AM
0 1 * * 0
# Log rotation every Sunday at 3:00 AM
0 3 * * 0
# Disk cleanup on the 1st of every month at 4:00 AM
0 4 1 * *
# System updates every Saturday at 2:00 AM
0 2 * * 6
Example 2: Application Scheduling
# Send daily digest email at 8:00 AM
0 8 * * *
# Generate weekly report every Friday at 5:00 PM
0 17 * * 5
# Clear expired sessions every hour
0 * * * *
# Sync data with external API every 30 minutes
*/30 * * * *
# Process payment queue every 5 minutes
*/5 * * * *
# Send monthly invoice on the 1st at 9:00 AM
0 9 1 * *
Example 3: Monitoring and Health Checks
# Health check every 5 minutes
*/5 * * * *
# Uptime check every minute
* * * * *
# Performance report every hour
0 * * * *
# Daily security scan at midnight
0 0 * * *
# Weekly vulnerability scan on Sunday at 2:00 AM
0 2 * * 0