ok, actually i found a more elegant way of dealing with this issue (which might be great especially for newbies). first create a udev-rule to have your wd-passport node is created at the same spot (in my case it's /dev/wdpassport) every time you plug it in and also so that a script is executed which puts a tray-icon in place with which you can spin-down your wdpassport.
here's my udev rule (simply replace ATTRS{model} with whatever fits your wdpassport)
/usr/local/bin/wdp
----------------------------------------------------
#!/bin/bash
# Put a notification-icon into the system tray
if DISPLAY=:0. sudo -H -u insert_your_username_here! zenity --notification --window-icon=/usr/share/pixmaps/wdumount.png --text="WD Passport is currently plugged in." ; then
echo "the icon should be in place now"
else echo "zenity error..." ;
fi
# If you click the icon you're presented the choice of safely removing WD Passport
if DISPLAY=:0. sudo -H -u insert_your_username_here! zenity --question --text "Do you really want to remove WD Passport (/dev/wdpassport)?" ; then
echo "icon clicked"
LOCATION=$(mount | grep "WD Passport")
if [ ${#LOCATION} != "0" ] ; then
pumount /dev/wdpassport 2> ~/wdp.log
fi
if scsi-spin -d /dev/wdpassport 2>> ~/wdp.log ; then
DISPLAY=:0. sudo -H -u insert_your_username_here! zenity --info --text="Success!\n\nWD Passport can be safely removed now."
exit;
else
ERRORS=$(cat ~/wdp.log)
DISPLAY=:0. sudo -H -u insert_your_username_here! zenity --warning --text="$ERRORS\n\nSorry, it seems things are screwed up badly (or WD Passport is simply not connected anymore)."
fi
else echo "cancel button was hit..."
wdp ;
fi
ok, actually i found a more elegant way of dealing with this issue (which might be great especially for newbies). first create a udev-rule to have your wd-passport node is created at the same spot (in my case it's /dev/wdpassport) every time you plug it in and also so that a script is executed which puts a tray-icon in place with which you can spin-down your wdpassport.
here's my udev rule (simply replace ATTRS{model} with whatever fits your wdpassport)
/etc/udev/ rules.d/ 95-wdpassport. rules ------- ------- ------- ------- ------- ------- --- ="sd?1" ,SUBSYSTEMS= ="scsi" , ATTRS{model} =="1200BEVExter nal ",SYMLINK+ ="wdpassport" , RUN+="/ usr/local/ bin/wdp"
-------
KERNEL=
and here's the script
/usr/local/bin/wdp ------- ------- ------- ------- ------- ------- --- your_username_ here! zenity --notification --window- icon=/usr/ share/pixmaps/ wdumount. png --text="WD Passport is currently plugged in." ; then
-------
#!/bin/bash
# Put a notification-icon into the system tray
if DISPLAY=:0. sudo -H -u insert_
echo "the icon should be in place now"
else echo "zenity error..." ;
fi
# If you click the icon you're presented the choice of safely removing WD Passport your_username_ here! zenity --question --text "Do you really want to remove WD Passport (/dev/wdpassport)?" ; then your_username_ here! zenity --info --text= "Success! \n\nWD Passport can be safely removed now." your_username_ here! zenity --warning --text= "$ERRORS\ n\nSorry, it seems things are screwed up badly (or WD Passport is simply not connected anymore)."
if DISPLAY=:0. sudo -H -u insert_
echo "icon clicked"
LOCATION=$(mount | grep "WD Passport")
if [ ${#LOCATION} != "0" ] ; then
pumount /dev/wdpassport 2> ~/wdp.log
fi
if scsi-spin -d /dev/wdpassport 2>> ~/wdp.log ; then
DISPLAY=:0. sudo -H -u insert_
exit;
else
ERRORS=$(cat ~/wdp.log)
DISPLAY=:0. sudo -H -u insert_
fi
else echo "cancel button was hit..."
wdp ;
fi