A me capita 1 volta su 2, ogni volta mi tocca cercare l'applicazione che mi occupa il device.
Allora ho pensato che si potesse fare qualcosa di più pratico con il mio caro linux,
ecco allora che ho modificato /opt/kde/bin/kdeeject che altro non è che uno script
Codice: Seleziona tutto
#!/bin/sh
# Script used by kdesktop to eject a removable media (CDROM/Tape/SCSI/Floppy)
# Relies on the 'eject' program, 'cdcontrol' on *BSD
#
# Copyright GPL v2 by David Faure <david@mandrakesoft.com>
#
if test $# -ge 1 -a "$1" != "--help"; then
quiet=0
if test "$1" = "-q"; then
quiet=1
shift
fi
# Checking for stuff in the PATH is ugly with sh.
# I guess this is the reason for making this a kde app...
OS=`uname -s`
case "$OS" in
OpenBSD)
cdio -f $1 eject >/dev/null 2>&1
;;
*BSD)
dev=`echo $1 | sed -E -e 's#/dev/##' -e 's/([0-9])./\1/'`
cdcontrol -f $dev eject >/dev/null 2>&1
;;
*)
eject $1 >/dev/null 2>&1
;;
esac
if test $? -eq 0; then
dcop kdesktop default refreshIcons
exit 0
elif test $quiet -eq 0; then
kdialog --title "KDE Eject" --warningyesno "Eject $1 failed ! \n (se scegli si sappi che causerà la chiusura del programma/i \n che occupa/ano il device) \n Vuoi forzare l'azione ? "
if test $? -eq 0; then
kill `lsof -t $1`
kdeeject $1
fi
fi
else
kdialog --title "KDE Eject" --msgbox "Usage: $0 <name> where name is a device or a mountpoint."
fi
exit 1
se si decide di forzare l'azione (if test $? -eq 0) allora contrillo i processi che occupano il device e li killo (kill `lsof -t $1`)
Un pò brutale ma efficace
Se può essere utile bene ... altimenti insultate pure



