watchdog timer? (1 Viewer)

peskywinnets

Registered User.
Local time
Today, 11:50
Joined
Feb 4, 2014
Messages
578
Any ideas for a watchdog timer, to say monitor a folder for a file that access has created..... & then notify someone remotely if the file hasn't been generated in the past x minutes? (I'm think email notification, but open to any ideas!)
 
Asking this on an Access forum leads to this comment. Doing what you ask - using the Access environment - is not particularly hard, but it implies that you must leave Access running during the time you want monitoring in place. Which means that trying to reboot your system might take longer because of I/O rundown considerations.

The phrase "monitor a folder for a file that access has created" adds to the mix. Are you now considering TWO apps? One app to create a file from somewhere (perhaps on a network-shared folder) and one app to check for a file being created somewhere? Might it be easier to just have the Access file creator send a message that says "I just sent you a file"? It might help if you gave us an idea of WHY you want this.

I'll amplify a point related to the logical principle that this question trips over. It is ALWAYS trickier to determine that something didn't happen than to determine that something DID happen. It's an offshoot from the logical principle that you can't prove the negative of a proposition. Just as an example, consider the statement "God exists." Now prove that wrong; prove the negative of it. Good luck with that.

Now, a more direct answer to your question: To do this in Access, it must be running continuously. You need a form with a timer running every so often to implement the file checks. Run the Form_Timer code not more often than once every several minutes, say 5 or 10 minutes - or longer. That is because running a timer too often drags down system performance like a drowning man drags down a lifeguard.

The timer event code can use the FileSystemObject to scan a directory in a way that would allow you to step through the files to look for the file you were expecting. You get the directory as an FSO object and then inside that directory is a collection of information for each file in the folder at that time. You can check properties such as size and file creation date to verify that you have a recent, non-trivial file.

Then, still inside the timer event, create a message file saying you did or didn't find the expected file. Then use a DoCmd.SendTo to mail the message to your target.

OK, that's HOW you would do it. But the far more important question is WHY you think it is necessary.
 
>> OK, that's HOW you would do it. But the far more important question is WHY you think it is necessary.

It's necessary, because if the process breaks (MS Access doesn't run all the APIs I've set it to run), then I'm in big trouble., Basically, I use access to go fetch my ebay orders (using a VBA API I knocked up)...but while I'm away (say for a few days on holiday), I want to re-route the order packing & shipping of these ebay orders over to Amazon (Amazon will ship orders out - I hold stock at their warehouses) ...so if MS access breaks...then orders won't get posted out = disgruntled customers = negative feedback = buy hesitancy)

My problem is form timers (certainly on my system) which trigger all this API activity, seem somewhat unreliable....quite often (& completely randomly) I see the timer has gone negative (for reasons unknown)...and this is why I need the WDT (in other words to capture when something has gone wrong with the form countdown timer)

So assuming MS Access is running all the time on my PC, I need a WDT to monitor it. I don't want to us MS Access to monitor itself...because my problem in the first place is with MS access timers not running consistently. As the saying goes, there are many ways to skin a cat ...and that's what I'm seeking. I had imagined there'd be windows WDT app available (which could be - for example - be configured to monitor for the absence of a file in a nominated directory within a certin timespan) ...but it seems not.
 
Last edited:
Consider power-shell or other types of scripting, then. You can make the Windows Task Scheduler run something every hour or so and not involve Access at all for the monitoring.
 
Any ideas for a watchdog timer, to say monitor a folder for a file that access has created..... & then notify someone remotely if the file hasn't been generated in the past x minutes? (I'm think email notification, but open to any ideas!)
Can you add an entry to the log table after file is generated? That way if the process fails, it is easy to detect.
 
Any ideas for a watchdog timer, to say monitor a folder for a file that access has created..... & then notify someone remotely if the file hasn't been generated in the past x minutes? (I'm think email notification, but open to any ideas!)

What machine (s) is it acceptable for this to run on?

If a single machine and not a independent server, just create a VBS (vbscript) file thats silently runs in background and continues, loops until 1=2

I've done that before on my own machine, as a crude way to watch for files on a network share, and then grab it before it gets moved somewhere
 

Users who are viewing this thread

Back
Top Bottom