⏰Cron Schedules
Every Day at Midnight
Run at 00:00 (midnight) every day - common for daily cleanup and maintenance.
Pattern
0 0 * * *Explanation
Runs at exactly midnight (00:00) every day. Classic time for maintenance tasks.
Examples
Cron Expression
Output
0 0 * * *
Runs At
Output
00:00 (midnight) daily
Code Examples
Crontab
# Crontab entry
0 0 * * * /path/to/daily-cleanup.sh
# Common uses:
# - Log rotation
# - Database backups
# - Cache clearing
# - Report generation Node.js
// Node-cron
const cron = require('node-cron');
cron.schedule('0 0 * * *', () => {
console.log('Running midnight maintenance');
// Cleanup tasks
cleanupOldLogs();
generateDailyReport();
});Try it Now
💡 Tips
- Avoid midnight if many jobs compete for resources
- Consider 2-4 AM for less system load
- Stagger multiple midnight jobs by a few minutes
- Monitor completion to ensure jobs finish
⚠️ Common Pitfalls
- Heavy load if many jobs run at midnight
- DST transitions skip or repeat midnight
- Long-running jobs may not finish before next run