[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
On 16/12/10 11:16, Gibbs wrote:
Here's how I do it quite successfully for a HP RDX drive with removable cassettes (drives)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...Cheers Gibbs
in fstab /dev/sdb1 /media/rdx ntfs-3g rw,user,noauto,exec 0 0 a script in cron.daily if mountpoint -q /media/rdx; then mount /media/rdx rsync -arvz /etc /media/rdx rsync -arvz /var/lib/samba /media/rdx rsync -arvz /home /media/rdx #Lastly, unmount the RDX Drive so it can be ejected eject /media/rdx else eject /media/rdx fiThe idea is that it backs up the data and ejects the removable drive, the user sees the drive is ejected, swaps it over ready for the next backup. There's no backups if the drive is not pushed back in.
I'm sure you can hack this to suit your needs. Martin -- The Mailing List for the Devon & Cornwall LUG http://mailman.dclug.org.uk/listinfo/list FAQ: http://www.dcglug.org.uk/listfaq