Re: Check if X is running

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Bill Jonas
Date:  
To: plug-discuss
Subject: Re: Check if X is running
On Thu, Nov 18, 2004 at 03:02:14PM -0700, Jared Anderson wrote:
> Just curious of the most effective way to determine if X is running in
> a shell script. I have used a few ugly methods of such, but they are
> ugly: the most recent is no longer effective while using radeonfb
> driver and splashutils. Any useful input would be appreciated!!


Do you mean running on the system, or if the script is being run under
X? If it's the latter, try something like this:

if [ ! -z "$DISPLAY" ]
then
    # X is running
else
    # X is not running
fi


-- 
Bill Jonas    *        *    http://www.billjonas.com/
"It's a dangerous business, Frodo, going out your front door.  You step
into the Road,  and if you don't keep your feet,  there  is  no knowing
where you might be swept off to."  --  Bilbo Baggins
---------------------------------------------------
PLUG-discuss mailing list - 
To subscribe, unsubscribe, or to change  you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss