delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/01/08/21:10:19

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.0 required=5.0 tests=BAYES_50,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,T_FRT_PROFIT1,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
From: =?UTF-8?B?QsWCYcW8ZWo=?= <blazhito AT gmail DOT com>
Date: Sun, 9 Jan 2011 03:09:42 +0100
Message-ID: <AANLkTikB2inU_PY7KDAs4vXGZ5dMhhWM=sK4s3mwMy7r@mail.gmail.com>
Subject: Cron service spawns windowless child, how to create a window?
To: cygwin AT cygwin DOT com
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Let me first explain the setup a little. I have a Windows PE app
(written in Delphi) that I want to keep running at all times and also
bullet-proof it against http connection timeouts, file reading errors
etc. It logs its actions periodically to a logfile so based on whether
this file was recently changed I can tell if the app is operational (ie.
it could be up and running, but not doing its job as intended).

Next up, I have cron running as service, I set up a following cronjob:
  * * * * * ~/md5compare.sh
This script creates a MD5 checksum of the logfile and compares it with
the one it created before. Source is here:
http://www.linuxforums.org/forum/programming-scripting/1319-shell-script-commands-check-if-file-has-changed.html
The important part that I changed is this:
  if [ "$OLDMD5PRINT" = "$MD5PRINT" ]
  then
  pkill -9 appname
  ~/linktoexe &
  fi
("linktoexe" is a symbolic link to the .exe file located elsewhere in
the Windows filesystem.)

This setup works fine as far as its desired functionality goes ie. once
the app is closed, abnormally stops its usual work, hangs on http
request (etc), it takes at most 2 minutes to restart and restore its
operation.

However, there is a problem: the Windows application is started by the
sh interpreter (which was run by the cron service), but in a windowless
state. I figured this was a cron service problem so I allowed for it to
communicate with the desktop (which is less than optimal) but that did
not help - instead, the GUI is broken. It seems no controls originating
from the app can be drawn in the window frame or tray icon (same with
context menus). The app responds to all user input, as I can see in the
logfile but doesn't give any visual feedback.

I tried hard to find an answer to this problem but I'm not really
Linux-savvy and my usual Google skills seem to have failed me.
Therefore my question is, is it possible and if so, how, to have the
Windows PE app run as intended, in a desktop window with its GUI fully
functional?

Thanks,
Blazej

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

- Raw text -


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