WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Using WD to monitor CMD file errors (Read 818 times)
TonyF
YaBB Newbies
*
Offline



Posts: 37
Using WD to monitor CMD file errors
Mar 22nd, 2016 at 6:35pm
 
I have a number of WatchDirectory tasks that run batch files. I use a second debug cmd file to run the 'real' cmd file so that I can capture the output of the 'real' cmd file in a log file.

On occasion, the debug cmd file reports an error (to the log file) when (say) a file cannot be copied or a file cannot be processed.

What I was thinking of doing was to set up a generic WatchDirectory task to monitor these log files (which will all be stored in the same folder) and when they are updated to scan the log files for certain 'error' strings. If there is an error, the task will email an alert to me with information on which log file contained the error. I expect the challenge will be to only detect error messages that have just been written to the log file and to ignore old historical error messages.

Does this seem a reasonable approach or is there a more elegant and efficient method of providing the same functionality?

Many thanks,

Tony
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: Using WD to monitor CMD file errors
Reply #1 - Mar 23rd, 2016 at 9:45am
 
Hello Tony,

That should be easy enough. Perhaps you can just use the email task and attach the log file. On "Filter Events" add a filter script that uses the FINDSTR command to scan the log file. See http://www.watchdirectory.net/wdhelp/ExampleFilterScripts/__README_ENGLISH.txt
There are several example filter scripts (including a few using FINDSTR) in <installdirectory>\ExampleFilterScripts.

Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
TonyF
YaBB Newbies
*
Offline



Posts: 37
Re: Using WD to monitor CMD file errors
Reply #2 - Mar 24th, 2016 at 3:05pm
 
Hello Gert,

I have set up an email plugin task and a filter script batch file that searches the detected file for strings and if any of them are found sends Y to the "%WD_FILTERRESULT%" as per your example filter scripts. The files seems to be detected OK. I now need to get a more comprehensive list of batch error messages that I can add to the filter script.

Thanks for all your help.  Smiley

Regards,

Tony
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1