# What are cron jobs?

Cron jobs are tasks that run on a schedule, for example every night.

> Source: https://www.mainpath.ai/en/wiki/cronjobs/

## What it is

A cron job is a task with a clock. Clean up every night, fetch something every hour, build a report once a day. It runs even when nobody has the site open. The app does not wait for a click.

The site can look perfectly fine while the nightly job has not run for days.

## What it is made of

The name comes from cron, the scheduler on Unix servers. The idea is older than any one host: one line says minute, hour, day, and the command. In containers and platforms the same thing is often called a scheduled job or a worker. The question stays: when, what, and what happens if it gets stuck.

## What goes wrong

A task that takes longer than the gap until the next run otherwise starts twice. A task that aborts has to be visible to someone, or the report is missing and nobody notices. Logs and a clear end, success or failure, belong to it.

## What you otherwise look after yourself

For that you need a process that watches the clock, separate from web requests. If that process fails, nothing happens at night, and in the morning the site still looks normal.

## How it shows up on MainPath

MainPath takes on these scheduled tasks with the project, instead of you maintaining a separate crontab on every server.

