I want to copy a directory and its contents to my external USB hard drive when I connect it to my laptop automatically.
So, I created a file called 00-usb-backup.rules on /etc/udev/rules.d with this content:
ACTION=="add", ATTRS{idVendor}=="0480", ATTRS{idProduct}=="a208", RUN+="/home/fabio/bin/backup"
The backup script has permission to run as a program. And its content is:
#! /bin/bash
cp -r /home/fabio/Ads/ /media/fabio/BACKUP/teste/
Following the answer on another thread, I edited visudo and added the following on the last line:
fabio ALL=(ALL) NOPASSWD: /home/fabio/bin/backup
But when I connect the USB hard drive nothing happens. :(
Any ideas on what could be wrong?
Thanks!