I'm trying to run a program when I plug USB to my Raspberry Pi 3 model B.
I referenced below twohttps://hackaday.com/2009/09/18/how-to-write-udev-rules/https://unix.stackexchange.com/questions/65891/how-to-execute-a-shellscript-when-i-plug-in-a-usb-device
- write a *.rules file in /etc/udev/rules.d/ directory
sudo nano /etc/udev/rules.d/81-usb.rules- fill with
KERNEL=="sda1", RUN+="echo Hello World > /home/pi/hello.txt"- restart udev
sudo /etc/init.d/udev restartI almost tried every variation, rebooted a lot, just in case I'm missing something. But nothing works.
Thanks for reading.