Task/Job that returns Non Zero Exit Code - VisualCron - Forum

Community forum

raarsan1
2010-06-09T10:03:33Z
I have a task that runs a cmd. The command is a FC tool (compare files on MSDOS) that returns 0 in case of coincidance or Non Zero in case of not coincidance.
After that task I have to run another task in case of not coincidance.
I have controlled the error with the flow control of the first task indicating that goes to the second task on 'Non Zero Exit Code' error.

The result of the task is : Exception in Task: Non zero exit code.
The result of the job is: Failed.

I only watch the bad results on jobs after execution. If I have a lot of jobs, how can I make the job to result success in this case?

Thanks.

ErikC
2010-06-09T10:41:25Z
Visualcron looks at exitcodes of external programs like the FC tool.
Everything except exitcode 0 is seen as an error. So the job will fail.

You can create a batchfile which will send text to the screen:
@ECHO OFF
FC %1 %2 >nul
IF ERRORLEVEL 1 ECHO No Match

Run this file with two parameters for file 1 and file 2.

Now if there is a difference there is output and you can have a condition to check the output matching 'No Match' to start your 2nd task.

Because FC generates an errorlevel 1, the ECHO is executed. The ECHO command itself will run and has an exitcode of 0, so Visualcron won't let your job fail anymore.

Regards,
Erik
Uses Visualcron since 2006.
raarsan1
2010-06-09T11:02:30Z
If there is a difference , how can I make a condition to check the output matching 'No Match' and start my 2nd task?

Thanks again
ErikC
2010-06-09T11:32:14Z
Follow these steps:

-in your 2nd task add a condition set;
-in this condition set add a condition;
-set the condition type to visualcron;
-condition check object is auto
-match should set to: Task - Output - Contains - No Match

The actions of the condition set should be:
-on match all: continue
-on match any: continue
-on match non: exit
-on match error: exit

So now your 2nd task will run if the 1st task contains No Match in the output. If not it stops the job.

Hope you get it running!

Regards,
Erik
Uses Visualcron since 2006.
raarsan1
2010-06-09T13:57:19Z
I have test your example.

In case of coincidance it works correctly.
But with 2 different files (no coincidance),the job does not fail but never runs the 2nd task. Allways returns Zero Exit Code.




How can I do ? :

The 1st task compares with FC the file 1 and 2.
- In case of coincidence of file 1 and 2 I want to run a 3rd task.
- In case of not coincidence of file 1 and 2 I want to run the 2nd task.



Thanks.
ErikC
2010-06-09T14:27:39Z
Okay,.... three tasks, two conditions now.😎

1st task is running your batch file.
2nd task is the task doing something when the files are no match
3th task is the task when the files are identical

1st condition is looking at the output of the 1st task. If the output contains No Match the actions are in order: continue/continue/next/exit
2nd condition is also looking at the output of the 1st task. If the output is empty the actions are in order: continue/continue/exit/exit

(For both conditions it is better to exactly specify the output of the 1st task instead of using the previous task/job.)

The 1st condition is bound to the 2nd task, the 2nd condition is bound to the 3th task.

I just tested it myself and it works fine.

Regards,
Erik
Uses Visualcron since 2006.
raarsan1
2010-06-10T09:13:28Z
Ok. It works perfect.

Thanks a lot.
Scroll to Top