How do I get a script to run when certain devices are unmounted? I want to create a backup script that will backup my usb stick to a certain folder (keeping one previous backup) just before the disk is unmounted so that when I tell it to unmount it runs my script first then unmounts the device.
If this is not possible I would like the script to run when the device is plugged in.
Also is it possible to have a script that runs when my usb hard drive is plugged in that backs up certain parts of my home dir to the usb hard drive?
I guess really I just want to know how to make scripts run when something is mounted/unmounted. I did check the removable drives and media preferences option but you can't run a command when a removable drive is inserted. Any ideas?