Restart certain services after upgrading specific packages
0
votes
2
answers
214
views
I'm using a few services on my Ubuntu server that are based on .NET. The .NET runtime packages are set up for automatic updates with the unattended-upgrades package. While the .NET packages (dotnet-*) can be updated just fine, the processes that use them and are still running after the update seem to get a little confused sometimes, leading to malfunctions in the service (assembly load errors or runtime files not found).
So to resolve this, I'd like to restart the affected services after those dotnet packages have been updated. The update can happen any day but only during unattended-upgrades.
I could create another service (without .NET) that watches upattended-upgrade's log file to see if any dotnet-* packages have been updated and then restart those other services. But it's a lot of annoying work.
I could also use some special option in the systemd service files of the affected services to stop them before any other service is stopped, but that probably doesn't apply to a package update, and also I've never seen systemd also restarting the stopped service later. So that probably won't help.
Is there some config option in apt or dpkg or unattended-upgrades to run a custom script with the names of the updated packages, so that I could evaluate what needs to be done after today's update? I couldn't find anything out there.
Asked by ygoe
(263 rep)
Dec 29, 2024, 08:43 PM
Last activity: May 2, 2025, 04:12 PM
Last activity: May 2, 2025, 04:12 PM