# Cron jobs and daemons

> Scheduled commands and long-running processes such as queue workers, managed as systemd units.

## Cron

**Cron** runs commands on a schedule. Each entry becomes a systemd timer:

- a run never overlaps the previous one,
- a **Timeout (seconds)** stops runaway commands,
- the output is kept in the system journal (**Last run and logs**).

**Add schedule** with a **Name**, the user to **Run as**, a **Schedule (cron)** such as `*/5 * * * *` (every five minutes) or `30 3 * * *` (03:30 every day), and the **Command**. **Run now** starts it immediately; **Enabled** pauses or resumes it. Commands are stored encrypted. Entries that run as root (or a sudo user) need your passkey when you save them.

Some apps add their own entries: the Laravel scheduler, Moodle, Mautic and Akaunting crons, and WordPress's WP-Cron when you move it to the system timer.

## Daemons

**Daemons** keep programs running: queue workers, Node servers, bots. Each process is a systemd service that restarts when it exits; logs go to the journal.

**Add daemon** with a **Name**, the user to **Run as**, the **Command**, an optional **Working directory** and the number of **Processes** (for example four queue workers). **Status and logs** shows each process and its recent output; **Restart**, **Stop** and **Edit** manage it. Daemons of root or a sudo user need your passkey.

Laravel sites have a shortcut on their **Deploy** pane: the **Scheduler (every minute)** switch and the number of **Queue workers**. Node.js and Python apps get their web process as a daemon automatically.

## Resource limits

Cron jobs and daemons (Node.js and Python apps included) run together in one resource group with half the CPU and
disk priority of the web server and databases, so a busy app or a runaway job cannot slow down your sites or the
database. The group starts reclaiming memory above 80% of the server's RAM and never gets more than 90%. Each
daemon is limited to 1,024 processes and threads.

---
Source: https://zefily.com/docs/cron-and-daemons
