Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I forgot my pendrive plugged in when leaving the computer lab yesterday, and I would have lost it if it wasn't for a kind soul finding and returning it. I want to avoid this in the future and apparently there are some tools you can use in windows that warn you if you are leaving a pendrive behind when logging off or shutting down the computer. Is there anything similar that works on Linux?

I need this to work on Fedora 17 (GNOME 3 shell), and preferably without requiring administrator privileges.

share|improve this question
up vote 1 down vote accepted

You can create a logoff script (see Create a logoff script/task for Linux) which checks if a usb disk is currently used. That could be done doing something like

if [ `lsmod | grep usb_storage | grep -o -E [0-9]+[[:space:]]*$` -gt 0 ]; then echo -e "\a\a\a\a"; fi 

This command will determine if a USB drive is connected by testing the number of devices using the usb_storage module and ring the bell 4 times if any are still connected. You may choose to do something else instead, such as unmounting, but bear in mind that you are logging off at that point so options are limited.

share|improve this answer
The USB-checking bit works :) But now that I looked at your link, it looks like I will need to find a way to run a script on GNOME's logout, since the solution in the link you showed needs admin privileges. I will also need to find another way of doing the alerting (perhaps notify-send?), since those don't work on my machine. – hugomg Sep 27 '12 at 22:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .