# noust cron

Run commands on a schedule, as systemd timers.

```bash
noust cron [OPTIONS] COMMAND [ARGS]...
```

Subcommands: [`create`](#noust-cron-create), [`delete`](#noust-cron-delete), [`disable`](#noust-cron-disable), [`enable`](#noust-cron-enable), [`ledger`](#noust-cron-ledger), [`list`](#noust-cron-list), [`run`](#noust-cron-run), [`runs`](#noust-cron-runs)

## noust cron create

Create a cron job as a systemd timer, or rewrite one Noust already owns.

```bash
noust cron create [OPTIONS] NAME COMMAND
```

Arguments: `name`, `command`

| Option | What it does | Default |
|---|---|---|
| `--schedule` | hourly, daily, weekly, monthly, or a systemd OnCalendar expression. | `daily` |
| `--user` | Unix user to run as. The configured service_user by default. |  |
| `--working-directory` | Absolute directory to run the command in. |  |
| `--app` | Associate the job with a deployed application; its runtime directory (current/ for a releases application) becomes the default. |  |
| `--timeout` | Stop the command after this many seconds (1 to 86400); the run counts as failed. |  |
| `--service` | Run the command in this service of the --app application's Compose stack (docker compose exec) instead of on this server. |  |
| `--reason` | Why this change is made (a change reference, a ticket). Recorded with the command in the audit log; required only where a compliance framework asks for it (ENS) or security.change_reasons is on. |  |

## noust cron delete

Remove a cron job's timer and service units.

```bash
noust cron delete [OPTIONS] NAME
```

Arguments: `name`

| Option | What it does | Default |
|---|---|---|
| `-f`, `-y`, `--force` | Do not ask for confirmation. |  |
| `--reason` | Why this change is made (a change reference, a ticket). Recorded with the command in the audit log; required only where a compliance framework asks for it (ENS) or security.change_reasons is on. |  |

## noust cron disable

Disable a job's timer, keeping the unit files.

```bash
noust cron disable [OPTIONS] NAME
```

Arguments: `name`

| Option | What it does | Default |
|---|---|---|
| `--reason` | Why this change is made (a change reference, a ticket). Recorded with the command in the audit log; required only where a compliance framework asks for it (ENS) or security.change_reasons is on. |  |

## noust cron enable

Enable a job's timer and start it now.

```bash
noust cron enable [OPTIONS] NAME
```

Arguments: `name`

| Option | What it does | Default |
|---|---|---|
| `--reason` | Why this change is made (a change reference, a ticket). Recorded with the command in the audit log; required only where a compliance framework asks for it (ENS) or security.change_reasons is on. |  |

## noust cron ledger

Show which occurrences of a job ran, were late or never ran.

```bash
noust cron ledger [OPTIONS] NAME
```

Arguments: `name`

| Option | What it does | Default |
|---|---|---|
| `--days` | How far back to look. | `7` |
| `--json` | Print the ledger as JSON. |  |
| `--reason` | Why this change is made (a change reference, a ticket). Recorded with the command in the audit log; required only where a compliance framework asks for it (ENS) or security.change_reasons is on. |  |

## noust cron list

List every Noust cron job with its schedule and last result.

```bash
noust cron list [OPTIONS]
```

| Option | What it does | Default |
|---|---|---|
| `--json` | Print the jobs as JSON. |  |
| `--reason` | Why this change is made (a change reference, a ticket). Recorded with the command in the audit log; required only where a compliance framework asks for it (ENS) or security.change_reasons is on. |  |

## noust cron run

Start a job's service immediately, outside its schedule.

```bash
noust cron run [OPTIONS] NAME
```

Arguments: `name`

| Option | What it does | Default |
|---|---|---|
| `--reason` | Why this change is made (a change reference, a ticket). Recorded with the command in the audit log; required only where a compliance framework asks for it (ENS) or security.change_reasons is on. |  |

## noust cron runs

Show a job's recent executions, reconstructed from the journal.

```bash
noust cron runs [OPTIONS] NAME
```

Arguments: `name`

| Option | What it does | Default |
|---|---|---|
| `--limit` | Most runs to show. | `10` |
| `--json` | Print the runs as JSON. |  |
| `--reason` | Why this change is made (a change reference, a ticket). Recorded with the command in the audit log; required only where a compliance framework asks for it (ENS) or security.change_reasons is on. |  |

