Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Jul 2008 16:36:20 +0100
From:      Daniel Bye <freebsd-questions@slightlystrange.org>
To:        FreeBSD Mailing List <freebsd-questions@FreeBSD.ORG>
Subject:   Re: to shell (and  X window System) wizards.
Message-ID:  <20080703153620.GA37232@torus.slightlystrange.org>
In-Reply-To: <20080703021344.GA73949@thought.org>
References:  <20080703021344.GA73949@thought.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--fUYQa+Pmc3FrFX/N
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jul 02, 2008 at 07:13:50PM -0700, Gary Kline wrote:
>=20
> 	would this works, say in .zlogin, to  say that X is up:
>=20
> 	if [ -e /tmp/.X11-unix/X0 ]
> 	then
> 		echo "X is up."
> 		exit 0;
> 	else
> 		echo "No X yet"
> 		exit 1;
> 	fi
>=20
> 	or is there something more clever?

I'm not sure if it's any cleverer, but I would probably make a call to
pgrep(1) instead of relying on the existence of a file that might exist,
even if X isn't running (unusual, but it does happen now and then, here at
least) - something like

if (pgrep "Xorg")
then
  echo "X is up."
  exit 0
else
  echo "No X yet..."
  exit 1
fi

=2E.. should do the trick.

And bear in mind that ~/.zlogin is run *after* ~/.zshrc, whereas ~/.zprofile
is run *before* it. It might matter, depending on what you are trying to do.

Dan

--=20
Daniel Bye
                                                                     _
                                              ASCII ribbon campaign ( )
                                         - against HTML, vCards and  X
                                - proprietary attachments in e-mail / \

--fUYQa+Pmc3FrFX/N
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEARECAAYFAkhs8fQACgkQixf5fBYiFmpyKACgmqHkDUfXldzD6RT/IuiJEXks
vvMAnilW9AWenY5UMucRcm3aTzMNvoYT
=hBGJ
-----END PGP SIGNATURE-----

--fUYQa+Pmc3FrFX/N--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080703153620.GA37232>