[systemd-devel] How does systemd discover template instances?

Ansgar Burchardt ansgar at 43-1.org
Fri Oct 16 02:12:00 PDT 2015


Michael Chapman <mike at very.puzzling.org> writes:
> On Thu, 15 Oct 2015, Stuart Longland wrote:
>> Assuming I have a few files distributed in the base package:
>> 	/lib/systemd/system/comms-drivers.service
>> 	/lib/systemd/system/comms-drivers at .service
>>
>> Ordinarily, one would tell systemd about template instances by creating
>> symbolic links.
>>
>> Suppose however I wanted to not do this, but instead, provide some
>> automatic discovery mechanism for systemd, so it could run a script that
>> would tell it what instances exist.
>>
>> Is there a mechanism for doing this in systemd?
>
> One approach you might want to consider is using a systemd generator
> [1] to create the instance symlinks automatically at boot, e.g.:

This was done for OpenVPN in Debian. As Stuart said he based his
sysvinit script on Debian's openvpn script, the systemd integration
might also help him.

The generator can be found at [2], the .service files at [3] and [4].

Ansgar

  [2] <http://anonscm.debian.org/cgit/collab-maint/openvpn.git/tree/debian/openvpn-generator>
  [3] <http://anonscm.debian.org/cgit/collab-maint/openvpn.git/tree/debian/openvpn.service>
  [4] <http://anonscm.debian.org/cgit/collab-maint/openvpn.git/tree/debian/openvpn@.service>


More information about the systemd-devel mailing list