← All topics

What are cron jobs?

A cron job starts a task on a schedule. It can prepare a report every night while nobody has the application open.

A report without a click

A cron job runs a task at set times, such as preparing an order summary every night. The schedule triggers the work without anyone needing to visit the website.

The application can remain available even if its daily report has been missing for days. A working website tells you little about whether a scheduled task succeeded.

Reading the schedule

Cron is a scheduler that originated on Unix systems. Its common schedule format has five fields for the minute, hour, day of the month, month, and day of the week. 0 4 * * * means every day at 04:00. The time your team sees depends on the time zone used by the scheduler.

The schedule needs a task to run, such as a command that generates the report. A worker that stays running serves a different purpose: it typically waits for work, whereas a cron job starts according to its schedule.

When runs overlap or fail halfway

If a report takes longer to produce than the interval between starts, two runs may work on the same data at once. A guard against overlapping runs keeps them from interfering with each other. Retrying after a failure should also avoid counting orders twice.

Record when each run starts and finishes and whether its output is complete. Error logs help explain a failure; an alert for a missed run helps someone notice it before the report is needed.

A documented schedule in MainPath

Easy Backup provides a concrete example for projects with a MySQL backend. Once enabled in the project configuration, it runs in production. Its default schedule creates a backup every day at 04:00 in the server’s time zone.

The backup documentation explains how to change that schedule. A custom task such as the order report also needs its own application code and a way to run it at the intended times.

Thank you for your request

We have received your request and will get back to you as soon as possible.

Would you like to talk to us directly?

Choose a time here for an introductory call with Robin.

Open the calendar in a new tab