PDA

View Full Version : [ubuntu] how to hook script to be run just before USB media removal



mafeusek
June 21st, 2010, 09:56 AM
Hallo.
I need to perform non-root command just before USB media is removed.

Have You got any ideas?

best regards,
Pawel

ajgreeny
June 21st, 2010, 11:09 AM
Give us lots more detail about what you are trying to do, and I'm sure many will attempt to help you, but there is not enough information at the moment.

mafeusek
June 21st, 2010, 09:27 PM
Give us lots more detail about what you are trying to do, and I'm sure many will attempt to help you, but there is not enough information at the moment.

sorry for giving too little details.

I have truecrypt volume file on my usb pen drive.
when USB is being removed I want "truecrypt -d /path/to/volume/file" command be performed.

that's it.

Additionally I wonder if removable medias are automatically unmounted at user logout and if user is being logged out automatically when system is going to be shut down?

best regards,
Pawel

ajgreeny
June 24th, 2010, 11:27 PM
I can't help with the first part of your query, but regarding the second, a usb drive will not be unmounted when you logout, as far as I'm aware. Only when you shutdown, then it certainly will unmount properly, as will all other mounted drives.