Score:0

Make Ubuntu wait for service to stop before rebooting

cn flag

I have a mini pc running Kubernetes (k3s) with homeassistant.

The issue leading to the question

When I do a sudo reboot (forgetting that the home assistant is running) the sqlite database becomes corrupted, presumably because it is writing to it as I am rebooting.

The question

Is there a mechanism to make Ubuntu wait for a service to shut down gracefully, to avoid this in the future?

uz flag
Jos
Don't use `sudo reboot`, use `sudo shutdown -r now` to reboot gracefully.
cn flag
isn't `sudo reboot` just a wrapper for `sudo shutdown -r now`?
uz flag
Jos
Yes, you are right. My bad. However, the service ought to be shut down gracefully then. I can't explain why that doesn't happen.
Terrance avatar
id flag
You'll probably find what you're looking for here: https://askubuntu.com/questions/293312/execute-a-script-upon-logout-reboot-shutdown-in-ubuntu
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.