Cron Job
ELI5 — The Vibe Check
A cron job is a task that runs on a schedule automatically. 'Every day at midnight, clean up old sessions.' 'Every hour, send digest emails.' It's like setting an alarm for your code — at the specified time, it just runs.
Real Talk
A cron job is a scheduled task that runs automatically at specified time intervals, defined using cron syntax (e.g., 0 * * * * for every hour). Named after the Unix 'cron' daemon. Used for routine maintenance, report generation, cache warming, and periodic data processing.
Show Me The Code
// Every day at midnight: 0 0 * * *
// Every hour: 0 * * * *
// Every 5 minutes: */5 * * * *
// Node.js with node-cron
cron.schedule('0 0 * * *', () => {
cleanupExpiredSessions();
});
When You'll Hear This
"Set up a cron job to send weekly digests." / "The cleanup cron runs every night at 3 AM."
Related Terms
Background Job
A background job is work your app does behind the scenes that the user doesn't wait for.
Scheduled Task
A scheduled task is just a cron job with a friendlier name. It's any piece of code that runs automatically at a set time or interval.
Worker
A worker is a background process that picks up jobs from a queue and does the heavy lifting.