LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   .bash_logout file is not runing on logout (https://www.linuxquestions.org/questions/linux-newbie-8/bash_logout-file-is-not-runing-on-logout-219813/)

Mordeth_0 08-19-2004 02:49 PM

.bash_logout file is not runing on logout
 
I am working on creating a workstation that multiple users will use. I automatically mount their network drive and on logout I want to automatically umount the network drive. I am able to mount the network drive fine but it seems to me that the .bash_logout file is not running on logout. My bash logout file looks as follows:

# ~/.bash_logout
sudo /sbin/fuser -km /home/<user>/dc/My\ Network\ Home/
sudo /sbin/fuser -km /home/<user>/DC/DEFENDER3/
sudo /bin/umount /home/<user>/DC/DEFENDER3/
sudo /bin/umount /home/<user>/dc/My\ Network\ Home/
mkdir /home/<user>/test
clear

I used the mkdir command to test that the .bash_logout file was running. It was not, the test folder was not created. Does anyone have any idea why my .bash_logout file is not working?

Tinkster 08-19-2004 02:53 PM

It isn't run if the shell is not a login-shell ...
It may not be if bash is invoked as sh,
but I didn't verify that.


Cheers,
Tink

Mordeth_0 08-19-2004 03:07 PM

Where do I change it to login shell or for bash to invoked as sh?

Tinkster 08-19-2004 03:11 PM

/etc/passwd is the place to define the users
shell if it's (meant to be) a login-shell.

.bash_login and .bash_logout most likely
wouldn't be evaluated if the user e.g. just
started a xterminal from within an already
running X session.


Cheers,
Tink

scuzzman 08-19-2004 03:11 PM

do this:
Code:

$su
Password:
#su USERNAME
$chsh /bin/bash


Mordeth_0 08-19-2004 03:25 PM

I'm already using the /bin/bash shell. It doesn't matter if I use root or another user the .bash_logout file will not run on logout. So did I accidentally disable the .bash_logout from running some where?

Mordeth_0 08-19-2004 04:23 PM

aahh death to the gui
 
I tried running the .bash_logout from another linux machine and it didn't' work either. BUT it does work when I login\logout using a command line interface (ctrl-alt-f1) my bash_logout script is run. I'm using KDE with kdm as my login manager. Is this something to do with KDE or kdm that they no longer use the .bash_logout file?

Tinkster 08-19-2004 04:29 PM

Most likely, in this case :)

Mine work fine, but I use xdm.

Have a look through kdm's config-file or
in KDE's documentation.

Cheers,
Tink

Mordeth_0 08-19-2004 05:36 PM

I tried xdm and gdm also so, I don't know...
I think I will try to attach a bash file to the Xsession file which(i think) runs every time that someone logs out to umount all my network drives. I just have to find the command to umount all network drives. I WILL figure out a way to run a shell script file some how when some one logs out. Any suggestions?
thanks again for all your help.

Mordeth_0 08-19-2004 06:11 PM

I was able to obtain my objective. I edited the file /etc/X11/xdm/Xsession which is run when ever someone logs in to the machine and I have it
umount -t ncpfs -all
which unmounts all my network drives as the new user logs in.

Thanks again to all who posted especially Tinkster.

josh


All times are GMT -5. The time now is 04:32 AM.