[olug] .bash_profile and runlevels

Ryan O'Rourke ryano at ch-gifts.com
Thu Jun 26 18:52:22 UTC 2003


On Thu, 2003-06-26 at 13:19, Christopher Cashell wrote:
> [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?

That is precisely what I want to do. Similar to a "Windows Startup
Folder".

> using .bash_profile
> wouldn't be the best place to put this.  You'd want to put it in
> $HOME/.xsession[1].

Unfortunately on my RedHat 8.0 box the only thing I can find about
xsessions is /etc/X11/xdm/Xsession and /etc/kde/kdm/Xsession. 
These don't look quite right, but google did find an example .xsession
here:
http://www.linuxgazette.com/issue49/bennet.html#homexcess

It looks like a .xsession file could be something as simple as this:
[root at ryano ryano]# cat /home/ryano/.xsession
#!/bin/bash
galeon &

> .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.
> 
> this would ensure that
> the program is run whenever you start/login to X Windows, but at no other
> time. 
>   [1] See /usr/share/doc/xfree86-common/examples/xsession for more
>       information.

Thanks for the pointer, Christopher. I'll keep it mind for other
applications.
I actually found a different solution to this problem:
Control Center --> Extras --> Sessions
and added my Wine process to the "Startup Programs" tab with a priority
of 70 so it runs after everything else.

I was just so used to manually configuring these types of things in
files that it didn't even cross my mind that RedHat might have a
"Windows way" of doing the same thing as the Startup Folder :-)

Thanks again!

-- Ryan



More information about the OLUG mailing list