How safe is it to restart the machine while Ghost is running?


I’m self-hosting a Ghost blog on a DigitalOcean droplet (a preconfigured one, on Ubuntu 18.04.5). I’ve taken a lot of steps to minimize the amount of maintenance required. One of them is doing unattended-upgrades. However, some upgrades require that the server is restarted. I’ve chosen to just have it email me when that needs to be done; at the moment I just ssh into it when I get an email, do ghost stop, and reboot (ghost restarts by itself after the reboot).

So what I was wondering is if I can also skip that. If someone is more familiar with the way Linux shuts down and how that affects a running ghost server, I’d like to learn more. I assume that when shutting down, a SIGINT or something like that is sent to Ghost? How safe would it be to just allow unattended-upgrades to restart the machine when it needs to?

If it’s not safe, then I see ghost stop does
sudo systemctl is-active ghost_IP
sudo systemctl stop ghost_IP

So is there a way to configure unattended-upgrades to run this every time before restarting the server?

I’m running Ghost v3.1.1, and I’ll upgrade as soon as I get the chance. I just assumed the answer wouldn’t depend on the version.

You should be fine restarting without explicitly shutting Ghost down since systemd should handle shutting it down the same way you’re manually doing it :slight_smile: