On 03/26/2014 01:50 PM, Kai Hendry wrote:
Thanks Michael for answering, :)

On 26 March 2014 18:59, Michael Biebl <mbi...@gmail.com> wrote:
2014-03-26 3:56 GMT+01:00 Kai Hendry <hen...@webconverger.com>:
If your daemon is not functional if the hardware is not present, I'd
probably start it via a udev rule and SYSTEMD_WANTS.
Do you have an example for this please?

I don't quite understand why I can't I just name the device in the
service file. Why does it have to be so confusing. Still don't
understand the need for escaping... is there a need?

The reason is when your hardware becomes available you activate the service.

My udev foo is a bit rusty but you can try something along the lines of...

/etc/udev/rules.d/98-shk-local.rules

SUBSYSTEM=="input", ENV{ID_INPUT_KEYBOARD}=="?*", ENV{.INPUT_CLASS}="kbd", TAG+="systemd", ENV{SYSTEMD_WANTS}+="shkd@%p.service"

/etc/systemd/system/shkd@.service

[Unit]
Description=Simple HotKey Daemon

[Service]
ExecStart=/usr/local/bin/shkd %I
Restart=always

[Install]
WantedBy=multi-user.target

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to