Re: Checking if the X Server is running

2007-10-02 Thread O. Olson

--- Holger Krull ha scritto:

> As someone pointed out in another post the sequence
> ps |grep has a risk of finding grep itself in the
> list. The command pgrep combines both and hasn't
> that risk.

Thanks for this tip. 
 
> 
> That can be avoided by dual nested start like:
> C:\cygwin\bin\bash.exe -c -l 'run bash -c -l
> "Xwin.exe :0 -query 192.168.11.1 -once &" '
> 
> The first bash closes after the command and so does
> the cmd window which started it. The & at the end is
> important to get a independend process.
> 

I don’t think I managed to get this to work. This
seems to open a single big window for cygwin – which
is not want I wanted. So I then went in and added the
–multiwindow flag. With this, I again got that error
i.e. error dialog. 

I actually want to find a way to execute graphical
applications by this method. So with this method –
even if we succeed, would not allow me to start up a
graphical application. So I went ahead and edited this
– so that it runs a shell script instead of XWin.exe –
however with that I either get the error dialog, or
nothing works. 

O.O. 



  ___ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



RE: Checking if the X Server is running

2007-10-02 Thread Jörg Schaible
[EMAIL PROTECTED] wrote on Tuesday, October 02, 2007 4:21 PM:

> On Mon, Oct 01, 2007 at 05:33:12PM +0100, Phil Betts wrote:
>> It's probably not the cause of your problem, but you should
>> never use "ps | grep xxx" to detect if a process is running.
>> This is because the grep process will (sometimes) detect
>> itself and give you a false positive, and your xterm will
>> try to start when there is no server running.
> 
> A just a random snippet that I find useful for preventing just that:
> ps | grep xterm matches itself, since the command line contains
> 'xterm'. 
> 
> ps | grep '[x]term'
> doesn't match itself, since the command line no longer contains the
> string 'xterm'. 
> 
> It's more portable than
> pgrep xterm
> 
> and it's less ugly than
> ps | grep xterm | grep -v grep
> 
> So it's what I usually find myself using.

pidof XWin

- Jörg

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-10-02 Thread Matthew Wozniski
On Mon, Oct 01, 2007 at 05:33:12PM +0100, Phil Betts wrote:
> It's probably not the cause of your problem, but you should
> never use "ps | grep xxx" to detect if a process is running.
> This is because the grep process will (sometimes) detect 
> itself and give you a false positive, and your xterm will 
> try to start when there is no server running.

A just a random snippet that I find useful for preventing just that:
ps | grep xterm
matches itself, since the command line contains 'xterm'.

ps | grep '[x]term'
doesn't match itself, since the command line no longer contains the
string 'xterm'.

It's more portable than
pgrep xterm

and it's less ugly than
ps | grep xterm | grep -v grep

So it's what I usually find myself using.

~Matt

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-10-02 Thread Holger Krull
As someone pointed out in another post the sequence ps |grep has a risk of 
finding grep itself in the list. The command pgrep combines both and hasn't 
that risk.
 
> Thanks Holger. Now this works perfectly. It does open
> up a Windows cmd window – which remains open until I
> finish with my app – but I can live with that. 

That can be avoided by dual nested start like:
C:\cygwin\bin\bash.exe -c -l 'run bash -c -l "Xwin.exe :0 -query 192.168.11.1 
-once &" '

The first bash closes after the command and so does the cmd window which 
started it. The & at the end is important to get a independend process.

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-10-02 Thread O. Olson

--- Holger Krull ha scritto:

> Holger Krull schrieb:
> > Holger Krull schrieb:
> > I was to fast on my last email. I tested it now:
> > You need (on windows):
> > set DISPLAY=127.0.0.1:0.0& c:\cygwin\bin\bash.exe
> -l /home/krull/test.sh
> > 
> > (it is important that there is no space between
> 0.0 and &)
> > 
> > test.sh:
> > #!/bin/sh
> > ps |grep -i /xwin >/dev/null
> > if [ $? -eq "0" ]
> > then
> >xterm -e /usr/bin/bash -l &
> > else
> >run XWin :2 -multiwindow -clipboard
> -silent-dup-error
> 
> that :2 is from my testing, sorry, doesn't belong
> there
> 
> >xterm -e /usr/bin/bash -l &
> > fi
> > 

Thanks Holger. Now this works perfectly. It does open
up a Windows cmd window – which remains open until I
finish with my app – but I can live with that. 

Thanks Phil Betts – I think now the checkX script also
works. I think my mistake was I was leaving a space
between set DISPLAY=127.0.0.1:0.0 and & - Thankfully
Holger pointed this out. 

O.O. 



  ___ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



RE: Checking if the X Server is running

2007-10-01 Thread Phil Betts
O. Olson wrote on Monday, October 01, 2007 1:49 AM::

>   I still don't think I can get this to work. I tried
> this from the command line (and my file is in
> /usr/local/bin/sd.sh)
> 
> C:\cygwin\bin\bash --login /usr/local/bin/sd.sh
> 
> This still brings up the Fatal Error Window.
> 

It's probably not the cause of your problem, but you should
never use "ps | grep xxx" to detect if a process is running.
This is because the grep process will (sometimes) detect 
itself and give you a false positive, and your xterm will 
try to start when there is no server running.

Since you already installed checkx, that's what you should 
be using, because (I believe) it actually connects to the X
server.

What you may be experiencing, is a race condition between
whatever process actually started X and the sd.sh.

I.e. if you initially start X using startxwin.bat (or similar),
and it hasn't got as far as starting the server when sd.sh 
checks if it's running, sd.sh will try to start the server.  
However, by the time sd.sh gets round to starting X, the 
first server has started, and therefore the second gives you 
the error.

Try something like this:


#!/bin/bash -l

# wait up to 5 seconds before deciding if X needs starting. You may
# need to up this to 10 seconds or more depending on your system.
wait_for_x ()
{
x_down=1
for (( i=0 ; i < 5 ; i++ ));do
echo "waiting for X"
if checkx;then
x_down=0
break
fi
sleep 1
done
return $x_down
}

if ! wait_for_x;then
  # X not yet up
  run XWin  # see [1]
  wait_for_x# see [2]
fi

exec xterm


[1] I don't advise running XWin directly.  It is better to use 
startxwin.sh.  This ensures that the required environment variables 
are set up, and that any stray socket left from an earlier unclean 
exit is cleaned up.  The script does what it does for good reasons.
Of course the default startxwin.sh starts xterm anyway, so you may
want to edit it.  (IMHO it was a big mistake to start xterm in the 
server start scripts.  It confuses way too many newbies, who think 
the scripts are the proper way to start xterm, then complain when 
they get errors trying to open a second xterm.)

[2] The run command returns control to bash before XWin has finished 
initialising, so the wait is necessary to ensure that xterm isn't
started before the server is usable.


Phil

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-10-01 Thread Holger Krull
Holger Krull schrieb:
> Holger Krull schrieb:
> I was to fast on my last email. I tested it now:
> You need (on windows):
> set DISPLAY=127.0.0.1:0.0& c:\cygwin\bin\bash.exe -l /home/krull/test.sh
> 
> (it is important that there is no space between 0.0 and &)
> 
> test.sh:
> #!/bin/sh
> ps |grep -i /xwin >/dev/null
> if [ $? -eq "0" ]
> then
>xterm -e /usr/bin/bash -l &
> else
>run XWin :2 -multiwindow -clipboard -silent-dup-error

that :2 is from my testing, sorry, doesn't belong there

>xterm -e /usr/bin/bash -l &
> fi
> 
> 
> 
> --
> Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:   http://cygwin.com/problems.html
> Documentation: http://x.cygwin.com/docs/
> FAQ:   http://x.cygwin.com/docs/faq/
> 


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-10-01 Thread Holger Krull
Holger Krull schrieb:
I was to fast on my last email. I tested it now:
You need (on windows):
set DISPLAY=127.0.0.1:0.0& c:\cygwin\bin\bash.exe -l /home/krull/test.sh

(it is important that there is no space between 0.0 and &)

test.sh:
#!/bin/sh
ps |grep -i /xwin >/dev/null
if [ $? -eq "0" ]
then
   xterm -e /usr/bin/bash -l &
else
   run XWin :2 -multiwindow -clipboard -silent-dup-error
   xterm -e /usr/bin/bash -l &
fi



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-10-01 Thread Holger Krull
O. Olson schrieb:
> --- Holger Krull <[EMAIL PROTECTED]> ha scritto:

Teach your email program to not include the full email adress while quoting!

 
> #!/bin/sh
> if `ps | grep XWin > /dev/null`

I suggest using grep -i 
to make it case ignoring. I found a cygwin installation that has Xwin and not 
XWin in the process list.


> Now I modified the above shell script to: 
> 
> --
> #!/bin/sh
> if `ps | grep XWin > /dev/null`
>then
>   xterm -e /usr/bin/bash -l
>else
>   XWin -multiwindow -clipboard -silent-dup-error

My guess is access control, try adding -ac to the xwin parameters to find out.




--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread O. Olson

--- Gary Johnson <[EMAIL PROTECTED]> ha
scritto: 
> You're welcome.
> 
> I've written a few batch files that call Bash
> scripts, but to be 
> honest, I seldom get these right the first
> time--there is usually 
> some aspect of the transition from Windows/DOS to
> Cygwin that I 
> overlook.  Since you're not giving yours any
> arguments, though, it 
> should be pretty straightforward.  I think the
> following should 
> work.
> 
>@echo off
>C:\cygwin\bin\bash --login /usr/X11R6/bin/sd.sh
> 
> Note the --login argument to bash.  That insures
> that your script 
> sees a normal login environment, including a proper
> PATH.
> 
> Regards,
> Gary
> 

Dear Gary,

I still don’t think I can get this to work. I tried
this from the command line (and my file is in
/usr/local/bin/sd.sh)

C:\cygwin\bin\bash --login /usr/local/bin/sd.sh

This still brings up the Fatal Error Window. 

Regards,
O.O. 



  ___ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread Gary Johnson
On 2007-10-01, O. Olson wrote:
> --- Gary Johnson <[EMAIL PROTECTED]> ha
> scritto: 
> > My guess is that you created that file with DOS line
> > endings.  Try 
> > converting it to use Unix line endings,
> > 
> >cd /usr/X11R6/bin
> >d2u sd.sh
> > 
> > then try executing it again.
> > 
> > Also, I would recommend putting such scripts that
> > you create 
> > yourself in /usr/local/bin rather than in a system
> > directory such as 
> > /usr/X11R6/bin.  Doing so will make it easier to
> > keep track of your 
> > scripts and will make it less likely that you will
> > lose them when 
> > doing an update of Cygwin.
> > 
> > Regards,
> > Gary
> > 
> Thank you Gary. I think that the DOS line endings were
> the problem. Once I did the conversion - this script
> worked exactly as I wanted. 
>   Now I am working on trying to see if I can somehow
> execute this script from a batch file i.e. by just
> clicking on it. I am not having success in this area -
> so if you have ideas let me know. 
>   By the way thanks for pointing out that I need to put
> this in /usr/local/bin . I would be doing that from
> now on. 

You're welcome.

I've written a few batch files that call Bash scripts, but to be 
honest, I seldom get these right the first time--there is usually 
some aspect of the transition from Windows/DOS to Cygwin that I 
overlook.  Since you're not giving yours any arguments, though, it 
should be pretty straightforward.  I think the following should 
work.

   @echo off
   C:\cygwin\bin\bash --login /usr/X11R6/bin/sd.sh

Note the --login argument to bash.  That insures that your script 
sees a normal login environment, including a proper PATH.

Regards,
Gary

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread O. Olson

--- Holger Krull <[EMAIL PROTECTED]> ha scritto:
> 
> I suggest you start the shell script from a
> batchfile.
> 
> Like:
> C:\cygwin\bin\bash.exe -l yourstartscript.sh
> Or make an Windows Icon with that command.
> 
> If yourstartscript.sh is not found you have to give
> the full path to it in cygwin notation.
> Like:
> C:\cygwin\bin\bash.exe -l /home/krull/startscript.sh
> 
> There could be a remaining extra Window, can be
> avoided with:
> C:\cygwin\bin\bash.exe -c -l 'run bash -l -c
> "yourstartscript.sh &" '
> 

Dear Holger,

In addition to my previous mail, I tried the
following: 

I changed the shell script to:  (Called it
/usr/local/bin/sd1.sh)
--
#!/bin/sh
if `ps | grep XWin > /dev/null`
   then
echo "XWin is Already Started"
   else
echo "XWin is Not Started"
   fi


I then typed at the Windows CMD prompt: 
C:\>C:\cygwin\bin\bash.exe -l /usr/local/bin/sd1.sh

To get the message: 
XWin is Already Started

Now I modified the above shell script to: 

--
#!/bin/sh
if `ps | grep XWin > /dev/null`
   then
xterm -e /usr/bin/bash -l
   else
XWin -multiwindow -clipboard -silent-dup-error
xterm -e /usr/bin/bash -l
   fi
-

I now tried the same command as before: (With Setting
the DISPLAY)
C:\> SET DISPLAY=127.0.0.1:0.0; C:\cygwin\bin\bash.exe
-l /usr/local/bin/sd1.sh

I now get 
xterm Xt error: Can't open display: 127.0.0.1:0.0;
C:\cygwin\bin\bash.exe -l /usr/local/bin/sd1.sh

I am not sure where I am going wrong. 
Regards,
O.O. 



  ___ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread O. Olson

--- Holger Krull <[EMAIL PROTECTED]> ha scritto:
> 
> I suggest you start the shell script from a
> batchfile.
> 
> Like:
> C:\cygwin\bin\bash.exe -l yourstartscript.sh
> Or make an Windows Icon with that command.
> 
> If yourstartscript.sh is not found you have to give
> the full path to it in cygwin notation.
> Like:
> C:\cygwin\bin\bash.exe -l /home/krull/startscript.sh
> 
> There could be a remaining extra Window, can be
> avoided with:
> C:\cygwin\bin\bash.exe -c -l 'run bash -l -c
> "yourstartscript.sh &" '
> 
> 

Dear Holger,

Before getting this into a batchfile – I am trying to
see if I can get this to work from the Windows Command
prompt. 

Location of the Shell Script: /usr/local/bin/sd.sh
Contents of the Shell Script:  (As before)

#!/bin/sh
if checkX
   then
xterm -e /usr/bin/bash -l
   else
XWin -multiwindow -clipboard -silent-dup-error
xterm -e /usr/bin/bash -l
   fi
--
I then tried out that this shell script works as
expected i.e. if I have the X Server running it does
not attempt to start it again. 

I first tried something like: (With the X Server
already running)

C:\>C:\cygwin\bin\bash.exe -l /usr/local/bin/sd.sh

Here somehow the X Server again attempts to start up
i.e. I get the ugly Error message. I also get some
output telling me that “Fatal Server Error” (So I am
not sure what went wrong – either checkX did not work
correctly or what??)

I then tried something like: (With the X Server
already running)
C:\>C:\cygwin\bin\bash.exe -c -l 'run bash -l -c
"/usr/local/bin/sd.sh &"'

This time I get no output – but I still get the Error
dialog. I am not sure what I am doing wrong??


Vielen Danke,
O.O. 



  ___ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread O. Olson

--- Gary Johnson <[EMAIL PROTECTED]> ha
scritto: 
> My guess is that you created that file with DOS line
> endings.  Try 
> converting it to use Unix line endings,
> 
>cd /usr/X11R6/bin
>d2u sd.sh
> 
> then try executing it again.
> 
> Also, I would recommend putting such scripts that
> you create 
> yourself in /usr/local/bin rather than in a system
> directory such as 
> /usr/X11R6/bin.  Doing so will make it easier to
> keep track of your 
> scripts and will make it less likely that you will
> lose them when 
> doing an update of Cygwin.
> 
> Regards,
> Gary
> 
Thank you Gary. I think that the DOS line endings were
the problem. Once I did the conversion – this script
worked exactly as I wanted. 
Now I am working on trying to see if I can somehow
execute this script from a batch file i.e. by just
clicking on it. I am not having success in this area –
so if you have ideas let me know. 
By the way thanks for pointing out that I need to put
this in /usr/local/bin . I would be doing that from
now on. 
Regards,



  ___ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread Gary Johnson
On 2007-09-30, O. Olson wrote:

> Thanks Bengt-Arne for your quick reply. I think I got
> this installed. I now put the following into a file
> and am trying to execute it from the cygwin prompt. I
> get the error 
> 
> /usr/X11R6/bin/sd.sh: line 8: syntax error near
> unexpected token `fi'
> /usr/X11R6/bin/sd.sh: line 8: `   fi'
> 
> File ---
> #!/bin/sh
> if checkX
>then
>   xterm -e /usr/bin/bash -l
>else
>   XWin -multiwindow -clipboard -silent-dup-error
>   xterm -e /usr/bin/bash -l
>fi
> End File ---
> 
> I am sorry if this is a bit obvious - but I am trying
> to find a way to start applications using a windows
> batch file.

My guess is that you created that file with DOS line endings.  Try 
converting it to use Unix line endings,

   cd /usr/X11R6/bin
   d2u sd.sh

then try executing it again.

Also, I would recommend putting such scripts that you create 
yourself in /usr/local/bin rather than in a system directory such as 
/usr/X11R6/bin.  Doing so will make it easier to keep track of your 
scripts and will make it less likely that you will lose them when 
doing an update of Cygwin.

Regards,
Gary

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread Holger Krull
O. Olson schrieb:
> ps |grep XWin >/dev/null ||XWin -multiwindow
> -clipboard -silent-dup-error
> 
> to work from the Cygwin Command Prompt as well as from
> a script file (.sh). I am now trying to copy and
> modify my startxwin.bat file – to see if it can do

I suggest you start the shell script from a batchfile.

Like:
C:\cygwin\bin\bash.exe -l yourstartscript.sh
Or make an Windows Icon with that command.

If yourstartscript.sh is not found you have to give the full path to it in 
cygwin notation.
Like:
C:\cygwin\bin\bash.exe -l /home/krull/startscript.sh

There could be a remaining extra Window, can be avoided with:
C:\cygwin\bin\bash.exe -c -l 'run bash -l -c "yourstartscript.sh &" '


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread O. Olson

--- Holger Krull <[EMAIL PROTECTED]> ha scritto:
> I misstyped XWin, it is W not w. Sorry, i didn't
> test it.
> 

Dear Holger,

I can get your suggestion of 

ps |grep XWin >/dev/null ||XWin -multiwindow
-clipboard -silent-dup-error

to work from the Cygwin Command Prompt as well as from
a script file (.sh). I am now trying to copy and
modify my startxwin.bat file – to see if it can do
this. So I replaced the line 

%RUN% XWin -multiwindow -clipboard -silent-dup-error

Where the file starts the XWin with something like 

%RUN% ps |grep XWin >/dev/null ||XWin -multiwindow
-clipboard -silent-dup-error

To this I get “The system cannot find the path
specified” 

Now if I change that to 

%RUN% "ps |grep XWin >/dev/null ||XWin -multiwindow
-clipboard -silent-dup-error"

I get an error dialog from Run.exe telling me that it
could not find ps |grep XWin >/dev/null ||XWin
-multiwindow -clipboard -silent-dup-error  anywhere

I don’t know what I am doing wrong. 
Thanks a lot for your help and time,
O.O. 



  ___ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



RE: Checking if the X Server is running

2007-09-30 Thread O. Olson

--- Bengt-Arne Fjellner <[EMAIL PROTECTED]>
ha scritto:
> 
> Just run setup click next until your in the
> categories window.
> Click view till you reach not installed.
> scroll down till you see checkX
> select it and then next. 
> 
> -- 
> tel 0920 49 1894
> Bengt-Arne Fjellner

Thanks Bengt-Arne for your quick reply. I think I got
this installed. I now put the following into a file
and am trying to execute it from the cygwin prompt. I
get the error 

/usr/X11R6/bin/sd.sh: line 8: syntax error near
unexpected token `fi'
/usr/X11R6/bin/sd.sh: line 8: `   fi'

File ---
#!/bin/sh
if checkX
   then
xterm -e /usr/bin/bash -l
   else
XWin -multiwindow -clipboard -silent-dup-error
xterm -e /usr/bin/bash -l
   fi
End File ---

I am sorry if this is a bit obvious – but I am trying
to find a way to start applications using a windows
batch file.
O.O. 




  ___ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



RE: Checking if the X Server is running

2007-09-30 Thread Bengt-Arne Fjellner
O. Olson wrote:
> --- Gary Johnson <[EMAIL PROTECTED]> ha
> scritto:
>> You can use 'cygcheck' to find the Cygwin package
>> the contains a
>> particular program.  For example,
>> 
>>$ cygcheck -p checkX
>>Found 2 matches for checkX.
>>checkx/checkx-0.1.0-1   checks to see if Xserver is usable
>>checkx/checkx-0.2.0-2   checks to see if Xserver is usable
>> 
>> So you just need to install the checkx-0.2.0-2
>> package.
>> 
>> Regards,
>> Gary
>> 
> 
> Thanks Gary. So how do I install checkx-0.2.0-2.
>   I started the setup program and I tried checking in
> each of the major categories listed there - but got
> nothing
>   I then went into google and found that checkX lives
> http://cygwin.com/packages/checkx/
>   So do I have to compile the source? I do not want to
> do that.
> Regards,
> O.O.
> 
> 
> 
>   ___
> L'email della prossima generazione? Puoi averla con la nuova Yahoo!
> Mail: http://it.docs.yahoo.com/nowyoucan.html 

Just run setup click next until your in the categories window.
Click view till you reach not installed.
scroll down till you see checkX
select it and then next. 

-- 
tel 0920 49 1894
Bengt-Arne Fjellner

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread O. Olson

--- Gary Johnson <[EMAIL PROTECTED]> ha
scritto:
> You can use 'cygcheck' to find the Cygwin package
> the contains a 
> particular program.  For example,
> 
>$ cygcheck -p checkX
>Found 2 matches for checkX.
>checkx/checkx-0.1.0-1   checks to see if Xserver
> is usable
>checkx/checkx-0.2.0-2   checks to see if Xserver
> is usable
> 
> So you just need to install the checkx-0.2.0-2
> package.
> 
> Regards,
> Gary
> 

Thanks Gary. So how do I install checkx-0.2.0-2. 
I started the setup program and I tried checking in
each of the major categories listed there – but got
nothing 
I then went into google and found that checkX lives
http://cygwin.com/packages/checkx/ 
So do I have to compile the source? I do not want to
do that. 
Regards,
O.O. 



  ___ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread Holger Krull
O. Olson schrieb:
> --- Holger Krull <[EMAIL PROTECTED]> ha scritto:
>> There probably is a more elegant solution but doing
>> ps |grep Xwin >/dev/null || run Xwin -your options
>> here
>>
>> will only start Xwin if it is not running already.
>> (Assuming you will only start one Xwin)

>   I don’t think I managed to get this to work. Actually
> I am not sure if the pipes are working, because I am
> getting no output for 
> 
> $ ps |grep Xwin

I misstyped XWin, it is W not w. Sorry, i didn't test it.

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread Gary Johnson
On 2007-09-30, O. Olson wrote:

> Thanks Chuck. This looks like what I need - but how do
> I get this checkX program. It does not seem to be
> there in my path. 
>   Any pointers on where it would be installed. 

You can use 'cygcheck' to find the Cygwin package the contains a 
particular program.  For example,

   $ cygcheck -p checkX
   Found 2 matches for checkX.
   checkx/checkx-0.1.0-1   checks to see if Xserver is usable
   checkx/checkx-0.2.0-2   checks to see if Xserver is usable

So you just need to install the checkx-0.2.0-2 package.

Regards,
Gary

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



RE: Checking if the X Server is running

2007-09-30 Thread Bengt-Arne Fjellner
O. Olson wrote:
> --- Holger Krull <[EMAIL PROTECTED]> ha scritto:
>> 
>> There probably is a more elegant solution but doing
>> ps |grep Xwin >/dev/null || run Xwin -your options
>> here
>> 
>> will only start Xwin if it is not running already.
>> (Assuming you will only start one Xwin)
>> 
> 
> Dear Holger,
> 
>   I don't think I managed to get this to work. Actually
> I am not sure if the pipes are working, because I am
> getting no output for
> 
> $ ps |grep Xwin
No you shouldn't

> 
> However for
> 
> $ ps
>   PIDPPIDPGID WINPID  TTY  UID
> STIME COMMAND
> 23492   1   23492  23492  con  500
> 11:06:42 /usr/X11R6/bin/XWin

Observe it's XWin the first two are capitals.
so try 
ps |grep XWin
or
ps |grep -i xwin
which makes a case insensitive comparison (better if yor're unsure)
> 25152   1   25152  25152  con  500
> 13:14:28 /usr/bin/xterm
> I   25188   25152   25188  252080  500
> 13:14:28 /usr/bin/bash
> 26456   1   26456  26456  con  500
> 13:18:41 /usr/bin/xterm
> I   26492   26456   26492  265121  500
> 13:18:41 /usr/bin/bash
> 26128   1   26128  26128  con  500
> 13:28:20 /usr/bin/bash
> 23048   26128   23048  20344  con  500
> 13:28:23 /usr/bin/ps
> 
> So this seems OK - so I am wondering why the former
> command did not work. Could this be a problem with the
> Pipe?? I have no experience with this.
> 
> Thanks a lot for your help,
> O.O.
> 
> 
> 
>   ___
> L'email della prossima generazione? Puoi averla con la nuova Yahoo!
> Mail: http://it.docs.yahoo.com/nowyoucan.html 



-- 
tel 0920 49 1894
Bengt-Arne Fjellner

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread O. Olson

--- Holger Krull <[EMAIL PROTECTED]> ha scritto:
> 
> There probably is a more elegant solution but doing
> ps |grep Xwin >/dev/null || run Xwin -your options
> here
> 
> will only start Xwin if it is not running already.
> (Assuming you will only start one Xwin)
> 

Dear Holger,

I don’t think I managed to get this to work. Actually
I am not sure if the pipes are working, because I am
getting no output for 

$ ps |grep Xwin

However for 

$ ps
  PIDPPIDPGID WINPID  TTY  UID   
STIME COMMAND
23492   1   23492  23492  con  500
11:06:42 /usr/X11R6/bin/XWin
25152   1   25152  25152  con  500
13:14:28 /usr/bin/xterm
I   25188   25152   25188  252080  500
13:14:28 /usr/bin/bash
26456   1   26456  26456  con  500
13:18:41 /usr/bin/xterm
I   26492   26456   26492  265121  500
13:18:41 /usr/bin/bash
26128   1   26128  26128  con  500
13:28:20 /usr/bin/bash
23048   26128   23048  20344  con  500
13:28:23 /usr/bin/ps

So this seems OK – so I am wondering why the former
command did not work. Could this be a problem with the
Pipe?? I have no experience with this. 

Thanks a lot for your help,
O.O. 



  ___ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread O. Olson

--- Charles Wilson <[EMAIL PROTECTED]> ha
scritto:

> O. Olson wrote:
> 
> > Is there any way of checking if the X Server is
> > currently running? Because if you try this again,
> it
> > gives you “A fatal error” … which does not crash
> your
> > computer – but is a bit annoying to me. 
> 
> The checkX program is written specifically to do
> this.
> 
>#!/bin/sh
>if checkX ; then
>  # X is running
>else
>  # X is not running
>fi
> 
> --

Thanks Chuck. This looks like what I need – but how do
I get this checkX program. It does not seem to be
there in my path. 
Any pointers on where it would be installed. 

Thanks a lot
O.O. 



  ___ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread Charles Wilson

O. Olson wrote:


Is there any way of checking if the X Server is
currently running? Because if you try this again, it
gives you “A fatal error” … which does not crash your
computer – but is a bit annoying to me. 


The checkX program is written specifically to do this.

  #!/bin/sh
  if checkX ; then
# X is running
  else
# X is not running
  fi

--
Chuck

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread Rodrigo Medina
O. Olson wrote:
>   Is there any way of checking if the X Server is
> currently running? Because if you try this again, it
> gives you a fatal error which does not crash your
> computer, but is a bit annoying to me. 
> 
When XWin starts it writes a lock file /tmp/.X11-unix/X0.
When XWin ends properly it deletes the file. You can use
such file in order to know if XWin is running.

bye
RM


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Re: Checking if the X Server is running

2007-09-30 Thread Holger Krull
O. Olson schrieb:
>   Is there any way of checking if the X Server is
> currently running? Because if you try this again, it
> gives you “A fatal error” … which does not crash your
> computer – but is a bit annoying to me. 
> 

There probably is a more elegant solution but doing
ps |grep Xwin >/dev/null || run Xwin -your options here

will only start Xwin if it is not running already.
(Assuming you will only start one Xwin)

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/



Checking if the X Server is running

2007-09-30 Thread O. Olson
Hi,

Pardon my ignorance, and that I am never good in this
stuff. 

I have noticed that the startxwin.bat starts the X
Server using 
%RUN% XWin -multiwindow -clipboard -silent-dup-error

Is there any way of checking if the X Server is
currently running? Because if you try this again, it
gives you “A fatal error” … which does not crash your
computer – but is a bit annoying to me. 

I was thinking of making copies of this batch file
startxwin.bat to start various progrsms by clicking.
However when the second application starts up – it
pops this dialog box. I was wondering if there is a
way to avoid this. 

Thanks a lot,
O.O. 



  ___ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: 
http://it.docs.yahoo.com/nowyoucan.html

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://x.cygwin.com/docs/
FAQ:   http://x.cygwin.com/docs/faq/