[systemd-devel] Unload disabled units
Michael Chapman
mike at very.puzzling.org
Mon Sep 16 10:14:10 UTC 2019
On Sun, 15 Sep 2019, Daniel Duong wrote:
> Hi,
>
> I have a 2 template units: 1 for a service and 1 for a socket. Each
> instance is a version of my web application.
>
> After a successful deploy, I stop and disable the old version and I
> enable the new one:
> systemctl start belleshop at 0.2.socket
> # Test that everything is fine
> systemctl enable belleshop at 0.2.socket
> systemctl stop belleshop at 0.1.socket
> systemctl stop belleshop at 0.1.service
> systemctl disable belleshop at 0.1.socket
>
> I've done that for a few versions now, and it seemed to work OK. There
> is a little problem though. The old versions are still loaded:
>
> $ systemctl --no-legend --all list-units belleshop@*
> belleshop at 0.110.service loaded active running Belleshop server
> belleshop at 0.34.service loaded inactive dead Belleshop server
> belleshop at 0.36.service loaded inactive dead Belleshop server
> belleshop at 0.37.service loaded inactive dead Belleshop server
> [...]
> belleshop at 0.110.socket loaded active running Belleshop socket
> belleshop at 0.34.socket loaded inactive dead Belleshop socket
> belleshop at 0.36.socket loaded inactive dead Belleshop socket
> belleshop at 0.37.socket loaded inactive dead Belleshop socket
> [...]
>
> Is there any way I can unload these old versions?
You should check to see if anything is actually still referencing these
units. Try `systemd-analyze dump` and see if any "ReferencedBy" entries
appear for these units.
More information about the systemd-devel
mailing list