Cron job
Definition
A cron job is a scheduled command or script that runs automatically based on a time pattern. Cron jobs are often used for reminders, reports, cleanups, imports, and other repeated background tasks.
Why it matters
Cron jobs are useful when work needs to happen regularly without someone manually pressing a button. They should be reliable, logged, and designed so running them twice does not create duplicate problems.
Example in VCA
In VCA, a cron-style task could be used to send a reminder or process scheduled operational work, while the app database remains the source of truth.
Another Real World Example
A website might run a cron job every night to generate a sales report or clean up expired sessions.
Common mistakes
- Creating a scheduled task without logging success or failure.
- Letting the same job run twice at the same time.
- Assuming a cron job ran just because it was scheduled.
- Using the wrong timezone for reminders or reports.
- Making a cron job depend on a local machine being awake.