OlyPerson
August 2nd, 2010, 09:53 PM
Hey,
I need to create a system that syncs a folder on my laptop with any USB drive that is connected but I'm having a couple issues.
First, I can write udev rules for a script to run when a specific USB device is mounted, but not for any generic USB flash drive. My current udev rule I've created is:
ATTRS{serial}=="0d0g9d890", SYMLINK="usb_drive", RUN+="/usr/bin/my_script"
Second, the script I've written doesn't work when ran by the udev rule thing, but works when I run it in the terminal. I think this has to do with permissions of the USB drive, but I don't know how to work with FAT16/32 permissions. Here is my code:
#! /bin/bash
# This is a simple script that syncs folders
rsync -vaz /home/me/Documents/sample /media/UDISK/sample
I also need to learn a way to make it so any usb drive in /media is used instead of me having to specify which drive I want specifically.
Thank you guys for any help, it's really appreciated!:D
I need to create a system that syncs a folder on my laptop with any USB drive that is connected but I'm having a couple issues.
First, I can write udev rules for a script to run when a specific USB device is mounted, but not for any generic USB flash drive. My current udev rule I've created is:
ATTRS{serial}=="0d0g9d890", SYMLINK="usb_drive", RUN+="/usr/bin/my_script"
Second, the script I've written doesn't work when ran by the udev rule thing, but works when I run it in the terminal. I think this has to do with permissions of the USB drive, but I don't know how to work with FAT16/32 permissions. Here is my code:
#! /bin/bash
# This is a simple script that syncs folders
rsync -vaz /home/me/Documents/sample /media/UDISK/sample
I also need to learn a way to make it so any usb drive in /media is used instead of me having to specify which drive I want specifically.
Thank you guys for any help, it's really appreciated!:D