LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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, 03: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, 03:53 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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, 04: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, 04:11 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
/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, 04: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, 04: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 04:32 PM.
 
Old 08-19-2004, 05: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, 05:29 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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, 06: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, 07: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 09:28 PM
commnds placed in .bash_logout not working rddreamz Programming 1 06-05-2004 06:57 PM
.bash_logout does not get executed nearfar Linux - Newbie 3 10-17-2003 12:40 PM
.bash_login .bash_logout on KDE and GNOME ja_nch Linux - General 3 10-09-2003 10:09 PM
.bash_logout act weird!? IamDaniel Slackware 7 06-17-2003 01:30 PM


All times are GMT -5. The time now is 10:41 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration