I have some legacy softwares that I need to automate under Control-M. These job are under Windows 2008R2.
These jobs have an exit code 0 if they run ok, but also if they can manage some errors. I need to raise an alarm when a specific string is in the log.
The string is not in the output of executable.
I implemented another job for this. It goes to search a string inthe file and in "On Do Actions" I search for the statement.
To have the statement in the output I think to use something like a grep. I used:
findstr
findstr "myerrorcode" D:\Log\greptest_%%$ODATE..log
grep
under cygwin
In both case I have an identical situation:
- If the string is found, everythings is ok
- If the file is not found or cannot be open, grep or findstr return an exit code = 1. This is ok, because the job has to raise an error.
But the problem is: when the string is not found in the file, both grep and findstr have a return code = 1.
How can I discriminate the cases when the file cannot be open and when everything runs ok, but the sring in the log is not found?