Auto restart HA after failure

I’m running Home Assistant OS on a virtual machine on my ESXI server. Generally it works great. I don’t think I’ve had any issues with the OS itself, but HA occasionally breaks down for unknown reasons and just stops.

I have HA being monitored by UptimeRobot, so I get alerted when it’s no longer available. It’s rare that it crashes, but it happens often enough that I want a better recovery solution.

Is there a way to configure Home Assistant OS to automatically restart HA if it crashes?

Depends what you mean by “crash”.

Inside HassOS, the supervisor restart HA if itself detects HA has crashed. Does the supervisor itself crashes, or does HA enter a restart loop?

The HA service crashes and doesn’t come back up. I get notified by UptimeRobot that the URL is no longer available, so I remote into the server to check and I’m only able to see the final few lines of the log indicating that HA terminated all processes so it’s in a failed state. I’m able to just restart the service at that point and it loads back up fine.

Is the supervisor a separate service or is it running under the same process as HA itself? If it’s a separate process, I haven’t checked to see if it’s still available or not, but it doesn’t bring HA back up after the crash, so I assumed it was the same process.

I’d like to better be able to examine the logs, but I can’t pipe the log command to “less” since it’s not installed on HA OS. Do you know of a better way to actually view all of the logs?