This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

2011/1/9 BÅaÅej :
> 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:
> Â* * * * * ~/

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:
> 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: Â Â Â
> FAQ: Â Â Â Â Â Â Â Â Â
> Documentation: Â Â Â Â
> Unsubscribe info: Â Â Â

Reini UrbanÂ; Â Â Â ÂÂ

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]