script on unmount
Sebastian Spiess
sebastian.spiess at gmail.com
Sat Apr 19 13:11:00 BST 2008
Jackson Cooper wrote:
> Sebastian,
>
> The way I'd do it is create a daemon with an infinite loop (I don't
> know much about udev though) that looks for the folder
> /media/nameofusbdongle, and if it exists execute the rsync line, then
> an umount line. Something like...
>
> <CODE>
> while true; do
> if [[ -d /media/nameofdongle ]]; then
> rsync -switches /media/nameofdongle /some/other/path
> umount -switches /media/nameofdongle
> else
> sleep 1
> fi
> done
> </CODE>
>
> Then to make it a daemon, you could use the start-stop-daemon program.
> Type "man start-stop-daemon" in the terminal to find out more.
>
> - Jackson
>
>
> On Fri, Apr 11, 2008 at 7:55 PM, Sebastian Spiess
> <sebastian.spiess at gmail.com> wrote:
>> hi all,
>> I want to sync some of my USB dongle folders when I plug it in. I think I worked that out: create a rule
>> /etc/udev/rules.d/85-usbstick.rules and call the script to sync.
>>
>> But how about when I want to unplug the thing? Then there is no usb/hotplug event. Would the simplest thing be a script
>> with unmount/eject at the end?
>> How could I call this script through the icon (unmount menu) on the desktop?
>> How to make the eject/unmount wait until rsync is done?
>>
>> by the way what's the difference between unmount and eject?
>>
>> thanks Sebastian
>>
>> --
>> ubuntu-au mailing list
>> ubuntu-au at lists.ubuntu.com
>> https://lists.ubuntu.com/mailman/listinfo/ubuntu-au
>>
>
bugger, I missed you mentioning "man start-stop-daemon"
More information about the ubuntu-au
mailing list