[olug] .bash_profile and runlevels

Christopher Cashell topher at zyp.org
Thu Jun 26 18:19:37 UTC 2003


[Sorry that this e-mail is so late, work has caused me to get behind on
a number of mailing lists, and I'm just now getting caught up.]

At Wed, 21 May 03, Unidentified Flying Banana Ryan O'Rourke, said:
> Right now I have a command in .bash_profile that starts up a Wine
> session for an electronic In/Out board called "OutnAbout". The problem
> is that .bash_profile tries to start multiple instances of the program 
> every time I log in remotely.
> Basically, I want .bash_profile to look and see if the program is
> running already and if so, not attempt to start it again.
> Also, I'd like to tell .bash_profile to only attempt to start the
> program if I'm in runlevel 5. Is that possible if I default to a text
> login?

So, basically you want a program to run only if you login to X Windows,
correct?

If that's the case (I may be misunderstanding), then using .bash_profile
wouldn't be the best place to put this.  You'd want to put it in
$HOME/.xsession[1].

.xsession is much like the .bash_profile or .bashrc for X Windows.  It
contains a list of variables and programs to run when X Windows starts,
or when a user logs in to X (using xdm or a similar utility).  Most
commonly it starts things like an xterm, xbiff, a clock, etc, and it
generally ends by exec'ing a window manager.

Again, I may be misunderstanding your needs, but this would ensure that
the program is run whenever you star/login to X Windows, but at no other
time.  I'm guessing that this is the result you are looking for, and it
should be a lot easier than checking run levels and whether the program
is already running.

> -- Ryan

  [1] See /usr/share/doc/xfree86-common/examples/xsession for more
      information.

-- 
| Christopher
+------------------------------------------------+
| A: No.                                         |
| Q: Should I include quotations after my reply? |
+------------------------------------------------+



More information about the OLUG mailing list