It mounts by uuid any usb device inserted.
]]>And I had in mind the inclusion of the backup itself in the udev rule - not the use of the SYSTEMD_WANTS tag. (I don't know anything about the latter but others clearly do.)
]]>You "seem to remember" has FUD potential, could you care to find the post again?
he is probably referring to this: https://bbs.archlinux.org/viewtopic.php … 2#p1113682
imho this is way different, the SYSTEMD_WANTS tag is completely ok to use. yes, he may be mounting the drive from the script, but imho he is not "exploiting" anything here. I personally don't see a much more elegant way to do this.
these automount udev rules were however crappy and hackish. They were created by people who are like "but udisks is bloat!!1!" and whoever wrote them didn't really seem to know what he was doing because, for example, unmounting a device after it was unplugged from the system is completely non-sense.
]]>that reminds me, you can use the SYSTEMD_WANTS tag in udev to start the service when the device is plugged in. this is documented in "man systemd.device" (and according to the man page this is actually the recommended method).
it is however not supported to start long running processes via RUN+=.
]]>[Unit]
After=dev-....device
[Service]
ExecStart=/my/script.sh
[Install]
WantedBy=dev-....device
systemctl enable script.service
the service should then be started when the device is plugged in.
to get the unit name of the partition, check the output of:
systemctl --all --full -t device
Edit: read this http://www.reactivated.net/writing_udev_rules.html
]]>