[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: unmount a removable store automatically before xdm logout.



 Hi.

On Sun, 25 May 2014 15:55:16 -0700
peter@easthope.ca wrote:

> if [ -e MP/Mounted ]; then

A user could unmount the filesystem somehow, create an arbitrary file
there, and therefore fool your script.
Better check /proc/mounts for the needed filesystem (and its'
attributes) here.


>   if [ "$(command lsof -Fn MP)" ]; then 
>     # Files are open.  Abort logout to allow resolution.
>     exit 1

fuser -ck would kill any process using the filesystem in question.
You can also call 'umount -l' and rely on automatically unmounting the
filesystem once all offending processes will end.


> Not sure that "xdm restart" should run in the background.  

That depends on whenever you'll execute this script from an X client or
not. Stopping xdm would terminate X, which, in turn, will terminate all
X clients, which, in turn can prevent xdm from starting.

Reco


Reply to: