LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-19-2004, 02:49 PM   #1
Mordeth_0
LQ Newbie
 
Registered: Jun 2004
Location: Iowa
Distribution: Fedora Core 2
Posts: 16

Rep: Reputation: 0
.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?
 
Old 08-19-2004, 02:53 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 08-19-2004, 03:07 PM   #3
Mordeth_0
LQ Newbie
 
Registered: Jun 2004
Location: Iowa
Distribution: Fedora Core 2
Posts: 16

Original Poster
Rep: Reputation: 0
Where do I change it to login shell or for bash to invoked as sh?
 
Old 08-19-2004, 03:11 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
/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
 
Old 08-19-2004, 03:11 PM   #5
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
do this:
Code:
$su
Password:
#su USERNAME
$chsh /bin/bash
 
Old 08-19-2004, 03:25 PM   #6
Mordeth_0
LQ Newbie
 
Registered: Jun 2004
Location: Iowa
Distribution: Fedora Core 2
Posts: 16

Original Poster
Rep: Reputation: 0
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?

Last edited by Mordeth_0; 08-19-2004 at 03:32 PM.
 
Old 08-19-2004, 04:23 PM   #7
Mordeth_0
LQ Newbie
 
Registered: Jun 2004
Location: Iowa
Distribution: Fedora Core 2
Posts: 16

Original Poster
Rep: Reputation: 0
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?
 
Old 08-19-2004, 04:29 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 08-19-2004, 05:36 PM   #9
Mordeth_0
LQ Newbie
 
Registered: Jun 2004
Location: Iowa
Distribution: Fedora Core 2
Posts: 16

Original Poster
Rep: Reputation: 0
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.
 
Old 08-19-2004, 06:11 PM   #10
Mordeth_0
LQ Newbie
 
Registered: Jun 2004
Location: Iowa
Distribution: Fedora Core 2
Posts: 16

Original Poster
Rep: Reputation: 0
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Continue executing file after you logout digitalgravy Linux - Newbie 5 10-06-2004 08:28 PM
commnds placed in .bash_logout not working rddreamz Programming 1 06-05-2004 05:57 PM
.bash_logout does not get executed nearfar Linux - Newbie 3 10-17-2003 11:40 AM
.bash_login .bash_logout on KDE and GNOME ja_nch Linux - General 3 10-09-2003 09:09 PM
.bash_logout act weird!? IamDaniel Slackware 7 06-17-2003 12:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration