LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 12-16-2003, 01:02 PM   #1
andrewstr
Member
 
Registered: Oct 2003
Location: WA--USA
Distribution: Red Hat 9, Suse 10.2
Posts: 144

Rep: Reputation: 15
Question Which files contain individual user login / logout commands


I want to have fetchmail start when a certain user logs in (to X-Windows) and I want it to stop when that user logs out. Do such user configuration files exist? I have searched the web and the Red Hat 9 documentation but haven't been about to locate an answer to this seemingly simple question.

Thank you!
 
Old 12-16-2003, 11:11 PM   #2
TheRealDeal
Member
 
Registered: Jun 2003
Location: Central Coast, NSW, Australia
Distribution: Gentoo
Posts: 438

Rep: Reputation: 30
hi andrew,

i've got a few things starting and stopping when I log in with a certain account.

To start stuff when you log in edit the /home/user/.bash_profile

To stop stuff when you log out edit the /home/user/.bash_logout

Is that what you needed?

Good luck : )
Craig
 
Old 12-17-2003, 12:44 PM   #3
andrewstr
Member
 
Registered: Oct 2003
Location: WA--USA
Distribution: Red Hat 9, Suse 10.2
Posts: 144

Original Poster
Rep: Reputation: 15
Craig,

thanks for the info. I edited those two files and it seems to be working. I thought that the bash files were only executed if I opened up a Terminal window or logged in using text mode. I learned something new.

Andy
 
Old 12-17-2003, 03:06 PM   #4
TheRealDeal
Member
 
Registered: Jun 2003
Location: Central Coast, NSW, Australia
Distribution: Gentoo
Posts: 438

Rep: Reputation: 30
Cool glad it worked for you.

Have a good xmas.

>Craig
 
Old 12-17-2003, 03:36 PM   #5
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
If you enter the command info bash and do a search for .bash_profile you can get more information.


To save you time here is a snippet from the info display.

Invoked as an interactive login shell, or with `--login'
........................................................

When Bash is invoked as an interactive login shell, or as a
non-interactive shell with the `--login' option, it first reads and
executes commands from the file `/etc/profile', if that file exists.
After reading that file, it looks for `~/.bash_profile',
`~/.bash_login', and `~/.profile', in that order, and reads and
executes commands from the first one that exists and is readable. The
`--noprofile' option may be used when the shell is started to inhibit
this behavior.

When a login shell exits, Bash reads and executes commands from the
file `~/.bash_logout', if it exists.


I think that the ~/.bash_login script is intended for logging in to via a tty connection, whereas ~/.bash_profile is what is normally used.

.bash_profile is where you add to the default $PATH
whereas .bashrc, is where you would enter user aliases.

Note that we made the assumption that you are using an X windows session manager to log-in. These bash startup files execute when bash is started a log-in shell. If you start your session by typing startx. You might want to include a script in the ~/.kde/Autostart/ folder instead.

You will want to look around for a .bash_logout equivalent for a KDE session.

Last edited by jschiwal; 12-17-2003 at 03:39 PM.
 
Old 12-17-2003, 05:34 PM   #6
andrewstr
Member
 
Registered: Oct 2003
Location: WA--USA
Distribution: Red Hat 9, Suse 10.2
Posts: 144

Original Poster
Rep: Reputation: 15
Yes, I am using an X windows session manager (KDE's) to log-in.

I put "fetchmail" in my ~/.bash_profile and logged out. When I logged back in, fetchmail was running.

Thank you both for the info.
 
  


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
Passwording individual files SuSE05 Linux - Software 4 04-20-2005 06:14 AM
restricting individual user download speed bishal Linux - Software 0 07-17-2004 06:47 AM
user and group ids - individual permissions? LooseCanon Linux - General 2 09-14-2003 12:57 PM
Run commands at logout/shutdown sbaguz Linux - General 2 08-21-2003 11:55 AM
Burning individual files... nutshell Linux - General 4 03-02-2002 09:21 AM


All times are GMT -5. The time now is 09:34 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration