[systemd-devel] Enabling/disabling templated device activation

Chris Paulson-Ellis chris at edesix.com
Thu Jan 5 07:02:13 PST 2012


I'm having trouble getting my head round how hotplugged device 
activation should work with systemctl enable/disable.

I have a udev rule that uses ENV{SYSTEMD_WANTS}="foo@%k.service" to hook 
device hotplug to systemd and a template unit file for foo at .service that 
uses BindTo=dev-%i.device to ensure the service starts and stops 
properly and ExecStart=/bin/foo /dev/%i to actually manage the device.

This all works fine, but how do I allow the administrator to 
enable/disable this facility with systemctl? The cups example uses an 
indirection via cups.target, but this indirection only works because a 
template is not being used and a single cupsd manages all printer 
devices. The getty@ service can be enabled/disabled on a per-tty basis, 
but I want to enable/disable for all potential hotplugged devices, not 
ones I know the name of in advance (and I don't really understand how 
the getty@ stuff works anyway).

Regards,
Chris.



More information about the systemd-devel mailing list