Re: unmount a removable store automatically before xdm logout.
Hi. On Sun, 25 May 2014 15:55:16 -0700 pe...@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 -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20140526094253.13ca77023958203face74...@gmail.com
unmount a removable store automatically before xdm logout.
~/MP is the mount point for a removable store which contains sentinel Mounted. ~$ mount | grep MP /dev/sda1 on /home/peter/MP type ext2 (rw,nosuid,nodev,relatime,errors=continue,user_xattr,acl,user=peter) peter@dalton:~$ ls -l MP/Mounted -rw-rw-r-- 1 peter peter 11 May 25 15:45 MP/Mounted This is the draft logout script. ~$ cat mylogout cd /home/peter if [ -e MP/Mounted ]; then if [ "$(command lsof -Fn MP)" ]; then # Files are open. Abort logout to allow resolution. exit 1 ELSE umount /home/peter/MP # sudo is configured to allow this w/o a password. nohup sudo /etc/init.d/xdm restart >/tmp/xdm.restart 2>&1 & fi fi exit 0 Not sure that "xdm restart" should run in the background. Any comment welcome. Thanks, ... Peter E. -- 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12 Tel +1 360 639 0202 http://carnot.yi.org/ Bcc: peter at easthope. ca -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/E1WohK0-0004Pa-Nm@dalton.invalid