D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Rsync External USB Drive

 

On Thu, Dec 16, 2010 at 11:16 AM, Gibbs <linux@xxxxxxxxxxxxxxx> wrote:
> I want to sync a load of directories when a specific USB drive is plugged in
> to an Ubuntu server. How can I run rsync when the drive is plugged in
> (automatically)? I've looked online but they all seem to be manual methods
> so I'm hoping that it's possible to trigger commands when things are
> mounted...

udev rules, they can/are scripts that can do what ever you want when
devices enter/leave certain states mainly add/remove and you can also
be specific to subsystems so you can watch for a usb device that
matches a specific vendor/product id. you also then get the chance to
add the device to your system under what ever /dev/ node you choose
and with user/group and permission you choose, so you could create it
owned by group "backup" for example.

http://reactivated.net/writing_udev_rules.html might be
helpful,remember you do need to mount the device, as the udev rule is
only associated with creating the /dev node but that can easily be
added in an additional program section or a RUN command etc

Robin

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq