Re: [systemd-devel] Unload disabled units

2019-09-16 Thread Daniel Duong
> 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.
It seems that they are referencing each other:

-> Unit belleshop@0.58.service:
[...]
ReferencedBy: belleshop@0.58.socket (destination-implicit)
[…]
-> Unit belleshop@0.58.socket:
[...]
ReferencedBy: belleshop@0.58.service (destination-file)
[…]
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Re: [systemd-devel] Unload disabled units

2019-09-16 Thread Daniel Duong
> Normally units should be unloaded immediately if they are stopped
> and didn't fail. What systemd version are you using? (One possibility
> to consider is that the glob matches *files*, and you are simply loading
> the units at the time the systemctl query is made. Use 'belleshop@*'
> instead.)
I still have the same problem with ‘belleshop@‘.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Re: [systemd-devel] Unload disabled units

2019-09-15 Thread Daniel Duong
> what about "systemctl daemon-reload”?
> it's not mentioned anywhere in your post
I tried, it doesn’t remove the old units.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[systemd-devel] Unload disabled units

2019-09-14 Thread Daniel Duong
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@0.2.socket
# Test that everything is fine
systemctl enable belleshop@0.2.socket
systemctl stop belleshop@0.1.socket
systemctl stop belleshop@0.1.service
systemctl disable belleshop@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@0.110.service loaded active   running Belleshop server
belleshop@0.34.service  loaded inactive deadBelleshop server
belleshop@0.36.service  loaded inactive deadBelleshop server
belleshop@0.37.service  loaded inactive deadBelleshop server
[...]
belleshop@0.110.socket  loaded active   running Belleshop socket
belleshop@0.34.socket   loaded inactive deadBelleshop socket
belleshop@0.36.socket   loaded inactive deadBelleshop socket
belleshop@0.37.socket   loaded inactive deadBelleshop socket
[...]

Is there any way I can unload these old versions?

Here are my unit files:

belleshop@.service:
[Unit]
Description=Belleshop server
Requires=belleshop@%i.socket
After=network.target

[Service]
User=belleshop
Group=belleshop
ExecStart=/opt/belleshop/bin/belleshop-%i.pyz server --bind 
unix:/run/belleshop/belleshop-%i.sock
ConfigurationDirectory=opt/belleshop/
StateDirectory=belleshop
CacheDirectory=belleshop
RuntimeDirectory=belleshop
Environment="SHIV_ROOT=/var/cache/belleshop"
RuntimeDirectoryPreserve=yes
StandardOutput=journal
StandardError=inherit

[Install]
WantedBy=multi-user.target

belleshop@.socket:
[Unit]
Description=Belleshop socket

[Socket]
ListenStream=/run/belleshop/belleshop-%i.sock

[Install]
WantedBy=sockets.target

Daniel

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel