Score:1

systemd automatism to update enabled unit symlink when updating units

us flag
THX

Is there a way in systemd to update existing target want symlinks when updating a unit by a newer version higher in the unit load paths hierarchy?

On CentOS 3.10.0-1160.36.2.el7.x86_64 with systemd @ 219-78 I have had a service unit enabled for multi user as target using the default unit.

I.e., the symlink

/etc/systemd/system/multi-user.target.wants/foo.service

pointed to the package's original unit

/usr/lib/systemd/system/foo.service

Later on, I deployed a modified version of the unit to

/etc/systemd/system/foo.service

After running systemd daemon-reload, systemd knew in principle about the updated unit. However, after rebooting the node, the original service unit was started again by systemd as the symlink did not get updated.

I had do disable/enable the unit explicitly, i.e., removing and setting the symlink again to point it to the updated unit's location.

Is there a way to update target symlinks automatically similarly to daemon-reload, when a unit get's updated after a unit version is placed higher up in sytemd's path hierarchy?

Michael Hampton avatar
cz flag
As a general rule you should be using overrides rather than trying to replace the entire unit. This would not have occurred if you had done so.
us flag
THX
@MichaelHampton unfortunately, I do not consider systemctl's edit/overwrite not really applicable for machines under control of a configuration management like puppet, ansible etc.
Michael Hampton avatar
cz flag
Eh? That is exactly what they are good for!
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.