Cron service spawns windowless child, how to create a window?

Błażej blazhito@gmail.com
Mon Jan 10 06:44:00 GMT 2011


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



More information about the Cygwin mailing list