Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Jun 2001 18:10:55 -0600 (CST)
From:      Ryan Thompson <ryan@sasknow.com>
To:        FreeBSD-QUESTIONS <freebsd-questions@FreeBSD.ORG>
Cc:        "Christopher W . Aiken" <cwaiken@icubed.com>
Subject:   Re: Script Question
Message-ID:  <Pine.BSF.4.21.0106011805100.78185-100000@ren.sasknow.com>
In-Reply-To: <20010601155112.A532@johncoop>

next in thread | previous in thread | raw e-mail | index | archive | help
John Merryweather Cooper wrote to Christopher W . Aiken:

> On 2001.06.01 15:00 Christopher W. Aiken wrote:
> > 
> > What can I check in a tcsh script to see if X is running?
> > 
> > 
> > -=[cwa]=-
> > FreeBSD 4.2
> > 
> The DISPLAY environment variable (usually only set when X is running)
> would  be a good choice.  Checking the TERM variable for an xterm
> variant might also work (sometimes).

Yes, but perhaps it pays to ask the poster for more information, here.

Chris, do you need this script to check THE CURRENT SHELL to see if the
shell itself is running under X, or do you need to be able to detect from
anywhere, any user, whether X is running? (eg, at the console)

If it is the latter, there may be some hooks that I'm not familiar with,
but something as crude as the following (off the top of my head)...

if [ ps -ax | grep /usr/X11R6/bin/X | grep -v grep ]; then
	...
fi

...might work for you.


> jmc
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message
> 

-- 
  Ryan Thompson <ryan@sasknow.com>
  Network Administrator, Accounts

  SaskNow Technologies - http://www.sasknow.com
  #106-380 3120 8th St E - Saskatoon, SK - S7H 0W2

        Tel: 306-664-3600   Fax: 306-664-1161   Saskatoon
  Toll-Free: 877-727-5669     (877-SASKNOW)     North America


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0106011805100.78185-100000>