script on unmount
Jackson Cooper
mail at jacksonc.com
Sat Apr 12 07:30:58 BST 2008
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 <egeland at gmail.com> 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. ;)
More information about the ubuntu-au
mailing list