Jackson Cooper wrote:
> True..
> 
> So then perhaps you could do something if umount's exit status isn't
> 0... It'll still fail when the device is busy, but won't be stuck in
> an infinite loop.
> 
> eg.
> 
> <CODE>
> while true; do
>     if [[ -d /media/nameofdongle ]]; then
>         rsync -switches /media/nameofdongle /some/other/path
>         error=$(umount -switches /media/nameofdongle 2>&1)
>         if [ $? != 0 ]; then
>             echo "$(date): Error when un-mounting: $error" >>
> /var/log/usb_rsync_errors.log
>             exit 1
>         fi
>     else
>         sleep 1
>     fi
> done
> </CODE>
> 
> Also, you could use dbus-send to unmount it, it *may* be a bit
> cleaner. The command's in the format of "dbus-send --system
> --print-reply --dest=org.freedesktop.Hal
> /org/freedesktop/Hal/devices/volume_uuid_UUIDGOESHERE
> org.freedesktop.Hal.Device.Volume.UnMount"
> 
> - Jackson
> 
> On Sat, Apr 12, 2008 at 3:33 PM, Frode Egeland <[EMAIL PROTECTED]> wrote:
>> Oops, I didn't spot the umount until after I hit "send".. apologies. :)
>> The umount would do the trick, assuming nothing else makes the device busy,
>> THEN you'd get the infinite loop I was worried about. ;)
> 

Hi Jackson, Hi Frode,

as I am not really familiar with this I wanted to try something I already 
figured out (with lots of forum reading :-) )

so I created a udev rule:       sudo gedit 
/etc/udev/rules.d/85-usb_legend.rules &
it reads
        SUBSYSTEMS==“scsi”,DRIVERS==“sd”,KERNEL==”[0-9]*”,ATTRS{model}==“USB 
Flash Disk ”,ATTRS{vendor}==“General 
”,RUN+=”/home/seb/bin/legend_sync_mount.sh %k”

in the shell script I then call rsync
        #!/bin/sh
        rsync -avS -P /media/LEGEND/Documents/sync/TaskCoach/* 
/home/seb/sync/TaskCoach

somehow this is 99% similar to another script I set up to fix my external hdd
the only difference is the command called by the script, the scripts location 
(not in my home) and the ATTRS attributes

I am puzzled... why it is not working?

As for your solution it seemed to me that it fits not my usage scenario:
- home after work
- plug in and synch
- do something with the files on local hdd
- before unmount sync new/changed filed back to USB

When I get your idea right it will unmount right away!?
Still I would like to test you idea but I am not sure where to place your code. 
in a shell script I assume. I have no idea 
about the daemon though.

RE umount of busy drive I could use the lazy option.

Cheers,
Sebastian


-- 
ubuntu-au mailing list
ubuntu-au@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-au

Reply via email to