[olug] .bash_profile and runlevels
Matthew G. Marsh
mgm at midwestlinux.com
Thu May 22 15:11:56 UTC 2003
On Wed, 21 May 2003, Ryan O'Rourke wrote:
>
> 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.
man runlevel
It is a program that tells you what runlevel you are in.
Also I use a similar setup for detecting remote login:
if [ -n "${SSH_CLIENT}" ]; then
echo "You are remote"
fi
With of course the execution section doing something else. And assuming
that you use SSH for remote access. You can also look for TERM=xterm when
using X remotely to avoid the startup.
So you could do something like (after unwrapping the lines):
if [[ "`/sbin/runlevel`" == "N 5" \
&& -z "${SSH_CLIENT}" \
&& -z "`pidof THINGIE`" ]];
then
START.THINGIE
fi
'k?
> 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?
> Using RedHat 8.0
>
> Thank you.
>
> -- Ryan
>
>
>
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
>
--------------------------------------------------
Matthew G. Marsh, President
Paktronix Systems LLC
1506 North 59th Street
Omaha NE 68104
Phone: (402) 553-2288
Email: mgm at midwestlinux.com
WWW: http://www.midwestlinux.com
--------------------------------------------------
More information about the OLUG
mailing list