I am trying to setup a system such that a script gets executed everytime any USB storage device is mounted (in this case, automounted by systemd). Based on a few references here, here and here, systemd allows for the execution of custom scripts after a specific device is mounted, but these either:
- Need a specific device or mountpoint.
- Use udev, which triggers too early, and holds the mounting process.
- Use audits or logs, which isn't very satisfying.
Is there anyway to be less specific in systemd units, allowing for the use of ExecStart
after any succesful (auto)mount?
Best Answer
I can only poiting the way.
this triggers my unit clamtk.service
cat /etc/systemd/system/clamtk.service
But this works only good if your unit is started as user, and the unit is triggerd also for usb-harddrives.