Page 1 of 1

Execute command activity warning for file check

Posted: Tue Jun 11, 2013 3:47 pm
by neena
Hi, I am using execute command activity to check a file existence in unix and then trigger the next job. My command is like this
ls *.*
and in the triggers I am saying if the return value = 0 then trigger the next job otherwise exit.

When the file is found job sequencer is running fine. But when the file is not found execute command activity is throwing a warning and the reply is 2 which is correct. But can anyone please let me know how can I make the job sequencer not throw the warning if the command return code <> 0 ?

I tried few different ways one of them worked but I cannot get the command out put and return value at the same time. I need the output of the ls *.* command to capture the file name.

Posted: Tue Jun 11, 2013 3:56 pm
by chulett
Show us the warning. I'm assuming it's because you have the "Automatically handle" option enabled in your Sequence job.

Posted: Tue Jun 11, 2013 5:39 pm
by ray.wurlod
Create an explicit Failure trigger, even if it only goes into a Sequencer. This will override the default handling of "errors" (non-zero exit status values). You might also disable "log warnings after activities that finish with a status other than OK" in the sequence's job properties.

Posted: Wed Jun 12, 2013 9:36 am
by neena
Thanks so much for all the replies.

Automatically handle activities that fail is not checked.

Please see the warning message below.
(@ec_chk_file_exists): Executed: ls /home/../*.*
Reply=2
Output from command ====>
ls: cannot access /home/../*.*: No such file or directory

Execute command activity warning: (@ec_chk_file_exists): Command ls did not finish OK, reply = '2'
I have tried to create an explicit failure trigger by this command and then used the command output as the trigger condition.
ls #$SourceDir##pSubDir#*.* >/dev/null; echo $?
But the problem is I need the command output as the file names because I am also trying to capture the file names and then pass it as parameters to the rest of the process.

All I figured is create one more Execute command activity after the file check and then grab the file name as command output. Just trying to see if there is more nicer way of doing this.

Posted: Wed Jun 19, 2013 7:09 am
by neena
I am going to mark this topic as resolved but if anyone have information regarding how to make non zero exit status not to show up as warning in director. please let me know. Thanks.

Posted: Wed Jun 19, 2013 7:19 am
by chulett
Start by specifying which Sequence job compilations you have enabled. Also your previous attempt at redirection was incorrect as it redirected everything to /dev/null... try just redirecting stderr:

Code: Select all

ls #$SourceDir##pSubDir#*.* 2>/dev/null

Posted: Wed Jun 19, 2013 4:40 pm
by ray.wurlod
Two techniques are easy; there are others.
  • 1. Create an explicit Failure trigger. This takes precedence over other forms of error handling, even if it only runs into a Sequencer.

    2. Follow your command with a command that does return a zero exit status. This technique assumes that you can get the output of the first command from its output rather than from its exit status.