My script works fine and does what I want it to do when I call it from the console. But, for completeness, here it is:
Code: Select all
#!/bin/bash
# Purpose: For syncing files between two drives, where changes might occur
# on either. (I use it to backup documents between a PC and USB)
#
# Rsyncs $OLD-PATH to $NEW-PATH, ignoring newer files on $NEW-PATH. Then, rsyncs $NEW-PATH onto $OLD-PATH, ignoring newer files.
#
# Usage: ./ backup-script.sh
# Author: Cammo
# Date: Thur 8 May 2014
# Version: 0.1
# Disclaimer: Feel free to use it, but don't blame me if your computer conks out.
OldPath='/mnt/Storage/Uni/'
NewPath='/media/cameron/UUI/UniStuff/Uni/'
echo 'Hard drive path = ' $OldPath
echo 'USB path = ' $NewPath
rsync -uax --progress $OldPath $NewPath
rsync -uax --progress $NewPath $OldPath
echo ''
echo 'All done!'
It contains:
Code: Select all
ACTION=="add", SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0781", SYSFS{idProduct}=="5576", RUN+="/mnt/Data/Documents/backup-script.sh"
EDIT: And I've checked the idVendor and idProduct match up with that shown for my thumbdrive in lsusb (confirmed by running lsusb twice, once with my thumb drive plugged in and once with it removed).