# Run and restart an app's processes

## See what runs for an app

The **Processes** section of the app's page lists what runs for it. **Web**, which answers the app's requests, comes first, then each worker its framework can run, then anything else that runs for the app. Each row shows how the process is doing, the memory it uses and when it started. Coresmith reads them every minute.

The **Health** card at the top of the page sums them up, such as "3 running" or "1 failed, 1 keeps restarting". Choose it to jump to the list.

## Turn on a worker or the scheduler

Each worker the app's framework can run has a switch on its row. A row shows only for apps that can use it.

| Row                   | What it runs                                                                              |
| --------------------- | ----------------------------------------------------------------------------------------- |
| Queue worker          | Laravel's `queue:work`, or Horizon when the app has it and `QUEUE_CONNECTION` is `redis`. |
| Scheduler             | Laravel's `schedule:run`, every minute.                                                   |
| Reverb                | Laravel Reverb, with its host and keys added to the app's environment.                    |
| Server-side rendering | Inertia's SSR server, for Laravel apps that use Inertia and have a `build:ssr` script.    |
| Sidekiq               | `bundle exec sidekiq`, for Rails apps.                                                    |
| Solid Queue           | `bin/jobs`, for Rails apps.                                                               |
| Celery worker         | `celery -A <app> worker`, for Python apps that use Celery.                                |
| Celery beat           | `celery -A <app> beat`, for Python apps that use Celery.                                  |

A switch takes effect straight away, without a deploy. If a process fails to start, a banner on the app's page says why. For a worker, the switch turns off again, and **Show the log** in the banner shows the last lines the worker wrote.

## Restart a process

Choose **Restart** on the process's row, or **Restart all** at the top of the section to restart everything the app runs. A stopped or sleeping app has nothing to restart until it runs again.

**Log** on a row opens the app's **Logs** page with only that process's output. [Read an app's logs](/docs/apps/logs).

## Add a cron job

1. On the app's page, go to **Schedule** and find the **Cron jobs** card.
2. Add a schedule and a command, such as `0 3 * * *` and `php artisan reports:send`.

Each job runs in the app's live release, with its environment. A Go app's other programs run by name, such as `cleanup` for a package in `cmd/cleanup`.

Each job's row shows its last run, how long it took, its exit code, and when it runs next, in the server's time zone. A job that fails, or doesn't start within 2 minutes of when it was due, emails the team. [Get alerts](/docs/servers/alerts#cron-jobs).

If the jobs couldn't reach the server, for example while it was offline, the card says so and offers **Try again**.

Cron jobs are set from a computer or tablet. On a phone, the app's page leaves them out.

## See each app's processes on a server

The server's **Apps** tab has a **Processes** column that sums up each app. Trouble comes first, such as "1 failed, 1 keeps restarting". Otherwise it says how many run, or **Sleeping** for an app that sleeps until its next visit. Choose a row to open the app and see each process.

## Stop an app, or put it in maintenance

- **Stop the app**, in the **Danger zone** at the foot of the app's page, takes its processes down. Visitors see a maintenance page until you choose **Start it**.
- **Maintenance page**, a switch under **Domains** in **Other ways in**, shows visitors the same page but keeps the app's processes running, so workers and the scheduler carry on.

## Use less memory with Horizon

Horizon runs several processes, and each holds its own copy of your app's code. On a server that's short of memory, add `tevkert/queue-prefork` to the app with `composer require tevkert/queue-prefork` and deploy. Horizon's processes then share one copy. It works with Horizon up to 5.50 for now.
