idea: usb disk becomes available, do something
So I've been using this method to backup for some time: USB connection to an external SATA docking station, 1TB disk goes there. I then get on my system run dmesg, confirm the output below, mount /dev/sdd1 /opt.bk, then run a script I have that does all the backup magic.
I'd like to extend/improve this scheme by automating most, or possibly all of it. I'm wondering if anyone can tell me 1) is there a file in /proc that will tell me if this disk is available or not (I've looked and I'm not finding it) 2) does anyone have an example of a daemon or cron run job that watches for something in proc then acts on it? Code:
usb 1-1.4: new high speed USB device using ehci_hcd and address 3 |
What I have in my backup script is to mount my USB drive, test if the backup directory now exists, run the backup, then umount.
The backup script runs from a cron job and adds start and end times to a log file in my home directory so I know how long its taking and whether it completed. |
If you want to start a your backup script once your disk becomes available have a look at udev scripts: http://reactivated.net/writing_udev_rules.html
|
and if you use udev, you can tie the rule to a specific volumn name so that it backs up only when you plug in a device labeled for backup...
|
I used this. It's a bit sloppy but seems to work fine.
Code:
|
All times are GMT -5. The time now is 12:22 AM. |