Problem using unix command from execute command stage
Moderators: chulett, rschirm, roy
Problem using unix command from execute command stage
Hi All,
Scenario : I have to search a reject file in one of the unix path/directory after one job has run. If the reject file is present then the job sends a email notification to users with the reject file. If no reject file, then it sends a success email.
Solution: I have used Execute Command stage after my job runs in sequencer to achieve this. This stage has "find" in command line with proper path in paramters : /etldata/q2c01/error/ -name "Q2C_Rej_*" -ls | wc -l
Where Q2C_Rej_timestamp is my file name.
Also in Trigger tab i have mentioned the condition as:
Name Expression type Expression
Lnk_Rej_Notify ReturnValue-(Conditional) 0
Lnk_Rej_Notify ReturnValue-(Conditional) 1
But when I am trying to run the seq, it is aborting with error as below :
Command wc -l did not finish OK, reply = '1'
Unhandled failure (1) encountered executing command wc -l
Can anyone please help.
Thanks in advance.
Scenario : I have to search a reject file in one of the unix path/directory after one job has run. If the reject file is present then the job sends a email notification to users with the reject file. If no reject file, then it sends a success email.
Solution: I have used Execute Command stage after my job runs in sequencer to achieve this. This stage has "find" in command line with proper path in paramters : /etldata/q2c01/error/ -name "Q2C_Rej_*" -ls | wc -l
Where Q2C_Rej_timestamp is my file name.
Also in Trigger tab i have mentioned the condition as:
Name Expression type Expression
Lnk_Rej_Notify ReturnValue-(Conditional) 0
Lnk_Rej_Notify ReturnValue-(Conditional) 1
But when I am trying to run the seq, it is aborting with error as below :
Command wc -l did not finish OK, reply = '1'
Unhandled failure (1) encountered executing command wc -l
Can anyone please help.
Thanks in advance.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Re: Problem using unix command from execute command stage
Hence my reply.swapna07 wrote:But when I am trying to run the seq, it is aborting with error as below :
Command wc -l did not finish OK, reply = '1'
Unhandled failure (1) encountered executing command wc -l
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
An additional problem. Even once working, the base problem will still be the fact that a count of 1 will be considered an 'unhandled failure' with that option turned on unless the sequence job thinks you are handling the failure. And how you do that is documented in the same place that option is.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
I used "wc -l" in command line instead of "find" and searched if the file created is more than zero byte. So depending upon whether the file is zero byte or greater than that we would direct our o/p to desired link. Reject file is created in both the scenario whether we have reject or not. The difference would only be with size of file. However I still dont see good reason on why find command was not working.
Andy noted a good reason. However, there's a big difference between checking to see if a file exists versus checking to see if it is empty or not. Use whichever method is appropriate for your need.
ps. "test -s" would work as well for the latter.
ps. "test -s" would work as well for the latter.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers