This is another automation recipe for unmounting all USB devices. The idea is to loop through USB devices for gathering USB device and partitions name and then unmount them one by one.
This is the basic form:
$!/bin/shfor usb_device in /dev/disk/by-id/usb-*; do [ -e "$usb_device ] || continue target="$(readlink -f "$usb_device")" grep -q ^"$target" /proc/mounts && umount "$target" 2> /dev/nulldoneThis is the upgraded version with desktop notification. You need the notify-send package of your operating system:
$!/bin/shfor usb_device in /dev/disk/by-id/usb-*; do [ -e "$usb_device ] || continue target="$(readlink -f "$usb_device")" grep -q ^"$target" /proc/mounts && umount "$target" 2> /dev/nulldoneif [ ! "$(which notify-send)" = "" ]; then notify-send \ --urgency=normal \ --expire-time=20000 \ "You may now remove ALL your device"fiThat's all about automating USB dismounts.