# Maintenance mode

Source: https://frameleaf.app/docs/admin/maintenance-mode/

Maintenance mode gives you a quiet server to work on. It takes your server offline for everyone else while you do administrative work, such as restoring a database backup or replacing a library disk, and shows them the maintenance page instead.

While it's on:

- **Everyone else** sees the maintenance page instead of their library and is signed out.
- **Administrators** sign in on the maintenance page to end maintenance or restore a backup.
- **Uploads, mobile backups and shared links** pause until maintenance mode ends.

Frameleaf turns maintenance mode on by itself when you [restore a database backup](https://frameleaf.app/docs/admin/backup-and-restore/#restore-a-database-backup). When the restore finishes, the server opens again on its own. If the restore doesn't finish, the server stays in maintenance mode so you can read what happened, and you end it yourself.

## Start maintenance mode

1. Go to **Settings**, then **Maintenance**, then **Maintenance mode**.
2. Under **Maintenance mode**, optionally type a **Reason shown on the maintenance page**, such as "Replacing the library disk". A preview shows what people will see.
3. Choose **Start maintenance** and confirm. Everyone except administrators is signed out and sees the maintenance page, titled **Frameleaf is being looked after**, with your reason if you gave one.

You can also start it from the command line, from your Compose folder:

```bash
docker exec frameleaf_server frameleaf-admin enable-maintenance-mode
```

The command prints a sign-in address for the maintenance page:

```text
Maintenance mode has been enabled.

Log in using the following URL:
https://photos.example.com/maintenance?token=<token>
```

## End maintenance mode

On the maintenance page, signed in as an administrator, choose **End maintenance**. Everyone can sign in again straight away, and uploads and phone backups carry on by themselves. Or run:

```bash
docker exec frameleaf_server frameleaf-admin disable-maintenance-mode
```

## Signing in during maintenance

Maintenance mode uses its own sign-in, and Frameleaf handles it for you: if you start it from **Settings**, you're signed in to the maintenance page automatically when the server comes back.

If you're ever signed out, any of these gets you back in:

- Look in the server logs (`docker logs frameleaf_server`, or **Logs** beside the server on Manager's **Services** page) for the maintenance mode message followed by a sign-in address. The address uses your **Public server URL** (**Settings**, then **Frameleaf Cloud**, then **Remote access**) or, on a linked server, the address Frameleaf Cloud published. If the server has neither, it prints only the path (`/maintenance?token=…`); open that path on the address you normally use to reach Frameleaf.
- Run `enable-maintenance-mode` again. While maintenance mode is on, it says **The server is already in maintenance mode!** and issues a new sign-in address.
- Or run `disable-maintenance-mode`, sign in normally, and start maintenance again from **Settings**, then **Maintenance**.

A sign-in address works for 4 hours. After that the page says the link is no longer valid, so get a new one in any of the ways above.

## Good to know

- Maintenance mode doesn't stop the containers. To stop Frameleaf completely, for example to move a drive, use **Services** in [Frameleaf Manager](https://frameleaf.app/docs/admin/manager/#services) or `docker compose stop`.
- Moving the database, thumbnails or photos to another drive doesn't need maintenance mode: Manager pauses uploads and background work for you. See [Move data to another drive](https://frameleaf.app/docs/admin/move-data-to-another-drive/).
- On a Manager installation the server container has its own name. See [Server commands](https://frameleaf.app/docs/admin/server-commands/#how-to-run-a-command) for how to find it and run commands.
