Page 1 of 1

Execute Command Activity - Trigger Question

Posted: Fri May 19, 2017 1:39 pm
by brock125
I have a simple job that creates an extract. I want to compare the current extract to the previous extract to see if there are any differences. If there are differences then I want to send an email to notify a group that there are differences. If there are no differences then I don't want to do anything and the job should end.

This is the syntax I'm using to compare the 2 files:

cmp -s /iis_dev_data/outbox/Extract_ABC.csv /iis_dev_data/inbox/Extract_ABC.csv ; echo $?

The Director log shows the following:

Js_test_job..JobControl (@ExCmpFiles): Executed: cmp -s /iis_dev_data/outbox/Extract_ABC.csv /iis_dev_data/inbox/Extract_ABC.csv ; echo $?
Reply=0
Output from command ====>
1

The Trigger tab has the following:

Expression Type is Custom - (Conditional)
The Expression is: ExCmpFiles.$CommandOutput =1

The problem I'm having is it never finds the trigger expression to be true. The files are different (the command returns a value of 1) but it always stops instead of continuing on to the notification activity. I've tested it by changing the Trigger to Unconditional and it works just fine. Does anybody have any idea why the trigger doesn't recognize the Unix command result?

Posted: Fri May 19, 2017 2:56 pm
by chulett
It's the dreaded Field Marks (@FM) characters in the output, they need to be stripped from the result before the check. Or you can try array notation since they are returned in a dynamic array:

ExCmpFiles.$CommandOutput<1>=1

One of many deeper discussions here for your dining and dancing pleasure. :wink:

Posted: Fri May 19, 2017 3:19 pm
by brock125
Thanks Craig!!! I completely forgot about the field marks. That did the trick.