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: 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 Content-Language: en-CA To: cygwin AT cygwin DOT com References: <20211123090728 DOT 5af5b26a25220b55dec148bc AT nifty DOT ne DOT jp> From: Brian Inglis 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 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: cygwin AT cygwin DOT com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" 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