[systemd-devel] Generators, Targets and Stater Units - I am holding it wrong?
Marc Haber
mh+systemd-devel at zugschlus.de
Mon Jun 23 17:10:20 UTC 2025
Hi Lennart,
thank you for trying to help. tl;dr setting the symlinks accomplishes
the intended behavior.
On Mon, Jun 23, 2025 at 01:27:24PM +0200, Lennart Poettering wrote:
>On So, 22.06.25 22:30, Marc Haber (mh+systemd-devel at zugschlus.de) wrote:
>I am not sure I follow. What are you trying to do? Do you want that
>the service units you generated are automatically activated at boot
>without any further admin step?
Yes. The admin step is putting the configuration into the file that the
generator reads. It is a reimplementation of my first Debian package,
console-log, leveraging systemd's flexibility instead of putting
everything in an initscript on steroids (that was back in 2000) that
allows you to have a less syslog on tty9 and a less maillog on tty8, for
example.
>Or do you want that there's an
>explicit enablement step the user has to do via "systemctl enable"?
No.
>If you do not want that extra step, then just do create a symlink from
>the service units you generate (which you generate into one of the
>thre params that a generator gets passed via argv[], let's call the
>one you picked $TARGET) to the multi-user.target.wants/ subdir.
>
>i.e. add something like this to your generator code:
>
> mkdir -p $TARGET/multi-user.target.wants
> ln -s ../console-log-8.service $TARGET/multi-user.target.wants/console-log-8.service
> ln -s ../console-log-9.service $TARGET/multi-user.target.wants/console-log-9.service
Did that, works fine. Thanks.
>But then again I really don't grok what you are trying to do, maybe I
>misread your intentions entirely.
No, you didn't. This was very helpful.
The documentation in systemd.generator(7) is a bit terse in that regard.
I am not sure whether one can assume that a person reading this can
makes sense from "the usual .wants/ and .requires/ symlinks". That part
of systemd is usually abstracted away via the systemctl enable interface
so people might use systemd daily and still not have the fact that this
is controlled by symlinks in the filesystem on their radar. I'd add a
few more words to that regard any maybe even an example.
Greetings
Marc
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421
More information about the systemd-devel
mailing list