0

I have a systemd service that starts from a udev rule:

[Unit]
Description=Open DSLR camera device

[Service] ExecStart=/bin/sh -c "/tmp/test.sh"

/tmp/test.sh doesn't do much yet:

#!/bin/sh
echo "qwer" >> /tmp/dslr-udev-test.txt

I don't think the udev rule is relevant (it triggers on connecting my DSLR camera on usb). Here it is anyway:

SUBSYSTEM=="usb", ACTION=="add", ATTR{product}=="Canon Digital Camera", TAG+="systemd", ENV{SYSTEMD_WANTS}="dslr-device.service"

After running sudo systemctl daemon-reload and turning the camera on, the file /tmp/dslr-udev-test.txt shows new content. But only once! Turning the camera off and on again shows no new content.

After running sudo systemctl daemon-reload again, the file shows new content once upon turning on the camera, then no more upon further camera restarts.

What is preventing the service's ExecStart from running more than once after daemon-reload?

Gauthier
  • 870

0 Answers0