Re: to shell (and X window System) wizards.

2008-07-03 Thread Gary Kline
On Thu, Jul 03, 2008 at 04:36:20PM +0100, Daniel Bye wrote:
> On Wed, Jul 02, 2008 at 07:13:50PM -0700, Gary Kline wrote:
> > 
> > would this works, say in .zlogin, to  say that X is up:
> > 
> > if [ -e /tmp/.X11-unix/X0 ]
> > then
> > echo "X is up."
> > exit 0;
> > else
> > echo "No X yet"
> > exit 1;
> > fi
> > 
> > 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


i don't remember using pgrep last time, but it seems more
failsafe,
so thankee.  i seem to recall that /tmp/.X11* is zapped during
powerdown, butt for ssure, X has Got to be the the proc table:-)

gary

> 
> ... 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
> 
> -- 
> Daniel Bye
>  _
>   ASCII ribbon campaign ( )
>  - against HTML, vCards and  X
> - proprietary attachments in e-mail / \



-- 
  Gary Kline  [EMAIL PROTECTED]   www.thought.org  Public Service Unix
http://jottings.thought.org   http://transfinite.thought.org


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: to shell (and X window System) wizards.

2008-07-03 Thread Daniel Bye
On Wed, Jul 02, 2008 at 07:13:50PM -0700, Gary Kline wrote:
> 
>   would this works, say in .zlogin, to  say that X is up:
> 
>   if [ -e /tmp/.X11-unix/X0 ]
>   then
>   echo "X is up."
>   exit 0;
>   else
>   echo "No X yet"
>   exit 1;
>   fi
> 
>   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

... 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

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


pgpQGnb8FAuUm.pgp
Description: PGP signature