delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2021/11/23/01:06:47

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 977223858D35
Authentication-Results: sourceware.org; dmarc=none (p=none dis=none)
header.from=SystematicSw.ab.ca
Authentication-Results: sourceware.org;
spf=none smtp.mailfrom=systematicsw.ab.ca
X-Authority-Analysis: v=2.4 cv=FrgWQknq c=1 sm=1 tr=0 ts=619c84d0
a=T+ovY1NZ+FAi/xYICV7Bgg==:117 a=T+ovY1NZ+FAi/xYICV7Bgg==:17
a=IkcTkHD0fZMA:10 a=uYT-Tk0qkVT609LjNaIA:9 a=QEXdDO2ut3YA:10
Message-ID: <a97a9e8b-374c-86b4-2f73-ca6de8bc2671@SystematicSw.ab.ca>
Date: Mon, 22 Nov 2021 23:06:08 -0700
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.2
Subject: Re: bat File to Launch Remote X11 Application
To: cygwin AT cygwin DOT com
References: <b1d63a2e-6399-5171-f642-e964a3fcb1e3 DOT ref AT bellsouth DOT net>
<b1d63a2e-6399-5171-f642-e964a3fcb1e3 AT bellsouth DOT net>
<20211123090728 DOT 5af5b26a25220b55dec148bc AT nifty DOT ne DOT jp>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Organization: Systematic Software
In-Reply-To: <20211123090728.5af5b26a25220b55dec148bc@nifty.ne.jp>
X-CMAE-Envelope: MS4xfI950hWTpXN16arL2VzCe7EpEPKCnDm/18lfYPEnY00kXr8nVxnI6KncmPiqopLF2IY5bvSNuazaaHO6o0wjASwcPxO/OdjuDLO40EoDGElKARFYB0mi
j/WPARHiejjGatvCiA9JXHLlUY3jNn5jv3xOdv+HWZEl+bf2F4pO2aW30NaEg64c4rePf/tYRncrQMwJS9Qk4CgmZGHMus3pz/I=
X-Spam-Status: No, score=-1165.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL,
RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,
SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4
X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Reply-To: cygwin AT cygwin DOT com
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On 2021-11-22 17:07, Takashi Yano via Cygwin wrote:
> On Mon, 22 Nov 2021 14:15:32 -0500
> Dennis Putnam wrote:
>> I have a remote X application on a Linux system that I want to launch
>> with a Windows bat file. My main problem is how to determine if Cygwin/X
>> is running and if not launch it. Once verified I think all I need to do
>> is use SSH -Y with the command that starts the X application. Can
>> someone help? TIA.
> 
> What about something like:
> 
> set DISPLAY=:0
> for /f "usebackq delims=" %%A in (`tasklist ^|find /C "XWin"`) do if %%A==0 start C:\cygwin64\bin\XWin %DISPLAY% -multiwindow
> c:\cygwin64\bin\ssh -Y 192.168.0.133 xterm
> 
> Note that the above bat fails to start XWin if it is already
> started with DISPLAY other than :0.

Assuming Cygwin bin is in your PATH, check for xinit base process using 
one of the following commands:

$ tasklist /fi "imagename eq xinit.exe"		\
Image Name                   PID Session Name      Session#    Mem Usage
======================== ======= =============== ========== ============
xinit.exe                   2652 Console                  1      2,952 K
$ ps -aeW					\
    37738  37632  37632      2652 cons0    197609   Oct 21 /usr/bin/xinit
$ procps -C xinit				\
   PID TTY          TIME CMD
37738 cons0    00:00:00 xinit

for first two commands, add check for xinit running:

| fgrep -w xinit \

and in all cases, if not, add X start, and sleep 60 or so, to give the X 
server adequate time, before starting the remote client:

|| (run --quote /usr/bin/bash -l -c "cd; exec /usr/bin/startxwin"; sleep 
60;)

$ ssh -Y $REMOTE $CLIENT

If you want to find the display, try looking under /tmp/:

$ ll -go /tmp/.X*
-r--r--r--  1 11 Oct 21 09:56 /tmp/.X0-lock

/tmp/.X11-unix:
total 1.0K
srw-rw-rw- 1 0 Oct 21 09:56 X0=
-rw------- 1 0 Aug 18 10:31 X0.lock

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019