4

I want to launch a script everytime a USB stick is inserted. After experimenting with udev, I tried to accomplish my task with systemd (udev is supposed to run only short tasks). Systemd works fine except the fact that I have to enter the full path and name of the stick, so it works only with that specific stick. But I like to run the script on any stick. Is there any way of using wildcharts ( .*?)?

Has anyone a hint how to accomplish that task?

Thanks for your help

  • 1
  • udev with SYSTEMD_WANTS tag. See https://www.freedesktop.org/software/systemd/man/systemd.device.html -"udev is supposed to run only short tasks" Not entirely true. The task itself might be long running, activating the task needs to be short.
  • – Rinzwind Oct 04 '16 at 09:51
  • Thank you for your feedback, I didn't check it yet. Maybe I find today some time to chew trough the whole Systemd stuff and work out my solution. – user192299 Oct 05 '16 at 09:08
  • @user192299, similar question using udev to run for any usb storage device https://askubuntu.com/questions/625243/how-to-execute-c-program-whenever-a-usb-flash-drive-is-inserted – user.dz Oct 07 '16 at 18:48