I’m far from a Linux expert and have only been using HG on a Pi for a little over a year. I had assumed sudo shutdown stopped all services prior. However a recent post I read suggested stopping services prior to calling a sudo shutdown.
Is this realy required?
Should HG service be stopped prior to doing a Shutdown or reboot to be sure nothing gets corrupt and will a sudo systemctl stop homegenie.service truly prevent this?
I’ve not done this in the past but I’ll start to do this if the experts think it is a good safety practice.
It really does depend what you are trying to achieve. A shutdown for upgrade, a halt, a power off, a timed shutdown. Basically you need to figure out what bests suit your purposes.
I’d be interested to know what scenario would require HG service be stopped. For example I want to update Pi should I stop HG first?
All you have to do is put your script in /etc/systemd/system-shutdown
which is handled by systems halt.service.
There’s quite a bit of crossover between SysVinit and Systemd but the perceived wisdom now is to use the Systemd service for all your daemon services. Much easier to create and maintain.
I’ll put together a scheduled shutdown, upgrade and restart service when I get a moment.
So your saying services should be shut down prior to doing a restart, shutdown and even updates?
I’d not even thought of that.
Yes as part of the shutdown service. Typically seen in a LAMP or Apache server setup. An orderly shutdown of any server is required to ensure the like of SQL doesn’t have unwritten data not written to the database. Stops all those inconsistencies seen from time to time in HG.
As I mentioned earlier a shutdown/restart procedure for upgrade purposes can be easily integrated.
Thanks! I’ll update my shutdown,reboot and update programs I created in HG. Hate having to open a SHH session just to shutdown or reboot. Updating isn’t so bad as I like to see any warnings or errors which may occur.
It’s so important to see command output. Otherwise you need to examine logs to see any errors if they occur. Systemd has made things so easy in the daemon world but unfortunately HG was never updated to reflect this.
In fairness HG is an MS .NET application adapted to run in Linux with the help of an ageing Mono. It really needs a rewrite to reflect .NET Core but that’s for another day.