> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.squarecloud.app/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to use Auto Restart on Square Cloud

## What Auto Restart is

Auto Restart is an exclusive Square Cloud feature that **automatically restarts your application if it crashes**, helping keep it available without any manual action.

## How to enable it

In your `squarecloud.app` (or `squarecloud.config`) file, add:

```systemd
AUTORESTART=true
```

## How it works

When `AUTORESTART` is enabled and your app crashes, Square Cloud runs a series of checks before restarting it:

1. The app crashed or froze.
2. The app's uptime was **more than 60 seconds**.
3. The app's exit status was **1**.
4. The app **hasn't restarted in the last 60 minutes**.
5. The logs **don't contain an excluded error** — a SyntaxError, a non-existent version, a missing module, or an invalid dependency file. In those cases Auto Restart **will not** restart the app, because restarting wouldn't fix the problem.

If all the conditions are met, the app is restarted automatically. There is a **60-minute cooldown** between automatic restarts.

## Best practices

* Review your logs regularly to understand *why* the app is crashing — Auto Restart keeps it online, but it doesn't fix the root cause.
* Keep your `MAIN` file and memory allocation correct and up to date.

## Related

For more ways to maximize availability, see [How to keep bots online 24/7](https://help.squarecloud.app/en-us/article/how-to-keep-bots-online-247-1j8fio/). If your app keeps crashing on boot, the logs usually point to the cause — see [My application won't start: Verifying the start script](https://help.squarecloud.app/en-us/article/my-application-wont-start-verifying-the-start-script-147pgxu/).
