Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Use VFP to monitor if EXE is running
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Divers
Thread ID:
01572163
Message ID:
01572184
Vues:
63
Hi Rick, Larry

The problem with that approach is that WMI will tell you that the EXE is in memory, not necessarily running, for example it might have had a network problem or data corruption and it will be waiting for the user to close a message like "Error reading file" or similar and then you'll think is running normally.

We tackle this with a double approach, writing into a "Heartbeat" table and optionally checking some other table to see when it was last updated (not thru the OS last modified, that might be an option in some particular cases, but we use a date/time field)

For example:

We have lots of data loggers that have a serial connection and we need to write the input from it into tables 24/7, now the heartbeat will tell us that the program is running, but it says nothing about receiving data from the serial port, for that we check the table were we save the data to be sure that is also writing, then we have a definition table that tells us what is the expected frequency of received data, some tables might be writing several records per second, others only a few per day so the monitoring program compares the elapsed time since the last record written against this expected frequency and if there are no new records the monitor will mark it as "Idle", if there is no heartbeat in the defined heartbeat frequency for that particular server then is marked as "Down"

Also whenever a status of a server changes we record this change and the date time, so we could (we use to but now we do not) produce statistics about down/idle times for each server.



>If scripting is available, look at this to see how to do this in VFP without running a separate EXE (it should be fairly straight-forward to translate the VB code to VFP):
>
>http://msdn.microsoft.com/en-us/library/windows/desktop/aa394599%28v=vs.85%29.aspx
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform