I have a USB device (Pen drive) that collects a lot of data a fills up its storage regularly. The goal is to write a script that:
- accesses USB device
- mounts it as a storage device
- downloads data from the device
- safely unmounts the device for removal (upon completion of the download)
I found this question.
I have done all things from this but my udev rules are not reflected.
The shell script which I have set in .rules
file is not running on USB mount. My rules file is /etc/udev/rules.d/99-mydevice.rules
:
KERNEL=="sd*",SUBSYSTEM=="usb",ATTR{idVendor}="1d6b",ATTR{idProduct}="0002",ATTR{serial}="3f980000.usb",RUN+="/home/pi/newfile.sh"
and my USB system path is /sys/bus/usb/devices/usb1
Am I missing something?
#!/bin/bash cp /media/pi/dev_name/test.txt /home/pi/newfile.txt echo File transfer > log.txt
Once USB inserted cant get any logs in log.txt.
Plz help on this.
– Prajakta Apr 03 '17 at 05:29