Olivier Brunel:

With instanced services, it means when you enable such a service you add/specify an instance name. So e.g. the servicedir is "getty@" but you enable "getty@tty2" -- which just means the servicedir getty@ is copied under a different name in the scandir.

The intent being that to enable another getty, you just enable getty@tty3 and that's it. [...]


nosh has much the same. Look at the nosh-bundles package and you'll find a set of ttylogin@ttyv* service bundles, for starters. There are plenty of others, from mdmfs@-tmp to populate@var, with a whole bunch of kmod@* service bundles along the way.

The convert-systemd-units tool can convert templatized systemd units.

The configuration import subsystem instantiates multiple instances of a generic service for per-user dbus daemons, Warden jails, webcamd services, rfcomm_pppd services, static_arp, static_ndp, pefs, geli, geom, fsck, ZFS mounts, and so forth. If you want to know where the idea of instances of a generic can be used, look in the nosh-bundles package.

There's no instantiation mechanism in the service bundles themselves. Everything is pre-instantiated at conversion/creation time. That's when all of the template parameter substitution happens, not at runtime.

This is not to say that it's impossible to share service/ directories amongst service bundles. It's quite possible, and part of the design. It's just not used for instantiation; because in that case the service/ directories differ in their run/start/stop/restart programs, because of the instance names.

Reply via email to