delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/01/09/04:30:57

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,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
In-Reply-To: <AANLkTikB2inU_PY7KDAs4vXGZ5dMhhWM=sK4s3mwMy7r@mail.gmail.com>
References: <AANLkTikB2inU_PY7KDAs4vXGZ5dMhhWM=sK4s3mwMy7r AT mail DOT gmail DOT com>
Date: Sun, 9 Jan 2011 10:30:43 +0100
Message-ID: <AANLkTim9_oUC3OSsD_wfw4nCDDUPzxCx66fubi4U61mJ@mail.gmail.com>
Subject: Re: Cron service spawns windowless child, how to create a window?
From: Reini Urban <rurban AT x-ray DOT at>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

2011/1/9 B=C5=82a=C5=BCej :
> 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:
> =C2=A0* * * * * ~/md5compare.sh

You are running into a limiation of the System user, even with desktop
interaction enabled not all GUI controls will work due to windows security,
and it's no good idea to use GUI's as service anyway.
Same nightmare as running a X server as root.

I would propose
1. to use the standard windows mechanisms instead. at /interactive ...
or 2. if it's possible for you, run cron as user, not as System.

Application wise people are usually just stat the size of a growing logfile,
not md5, and act accordingly.
Testing http timeouts or locks, I usually test with a periodic
httpping, not with a logfile.
If the ping to a reliable server fails something is going on. (Modem,
router, windows, ...)

> 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:
> =C2=A0if [ "$OLDMD5PRINT" =3D "$MD5PRINT" ]
> =C2=A0then
> =C2=A0pkill -9 appname
> =C2=A0~/linktoexe &
> =C2=A0fi
> ("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: =C2=A0 =C2=A0 =C2=A0 http://cygwin.com/problems.html
> FAQ: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 http:=
//cygwin.com/faq/
> Documentation: =C2=A0 =C2=A0 =C2=A0 =C2=A0 http://cygwin.com/docs.html
> Unsubscribe info: =C2=A0 =C2=A0 =C2=A0http://cygwin.com/ml/#unsubscribe-s=
imple
>
>



--=20
Reini Urban
http://phpwiki.org/=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 http://murbreak=
.at/

--
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