Page 1 of 1

Passing output from shell script to a job

Posted: Fri Jul 01, 2005 2:36 pm
by pnchowdary
Hi Guys,

After executing a shell script using Execute Command stage in job sequencer, How do I capture the output value returned by the shell script and pass it on to a server job, without writing it to a sequential file and again reading it? Is there a direct way to do it?.

Thanks,
Naveen

Posted: Fri Jul 01, 2005 3:01 pm
by kduke
Use a filter stage. You could also pass in shell variables as parameters. You could also use pipes.

Posted: Fri Jul 01, 2005 3:13 pm
by pnchowdary
Hi Duke,

I am using server jobs, so I guess I can not use filter stage. I will try the other options.

Thanks,
Naveen

Posted: Fri Jul 01, 2005 7:22 pm
by ray.wurlod
In the Job Activity, click on Insert Parameter Value. This opens the External Parameter Helper dialog, on which you will see the Execute Command Activity.
Expand this and you will see three things that you can use to supply a value to the currently selected job parameter.
  • $CommandName the name of the command (shell script)

    $ReturnValue the exit status of the command

    $CommandOutput anything on the command's stdout

Posted: Sat Jul 02, 2005 1:49 am
by pnchowdary
Hi Ray,

Thanks for the detailed solution to my problem. I will follow your solution.

Thanks,
Naveen

Posted: Tue Jul 05, 2005 10:04 am
by pnchowdary
Hi Ray,

I tried to implement the solution pointed out by you and I am getting an error.
I have defined a job parameter called TestOutput and have populated it with the output value of $CommandOutput (actual value is "Execute_Command_0.$CommandOutput")

The following is the log of the job run
TESTEXESCRIPT..JobControl (@Execute_Command_0): Executed: /FTP/CPS/FTPPLAYGROUND/DEV/test.sh
Reply=0
Output from command ====>
/FTP/CPS/FTPPLAYGROUND/DEV/serial_test.txt

TESTEXESCRIPT..JobControl (@Job_Activity_1): Controller problem: Error calling DSSetParam(TestOuput), code=-4
[ParamValue/Limitvalue is not appropriate]
I am not using any LimitValue, therefore the problem is with the parameter value that I am passing. Could you please tell me what I am doing wrong ?

Thanks,
Naveen

Posted: Tue Jul 05, 2005 3:20 pm
by ray.wurlod
What type is the job parameter? String? Integer? Date? The error code -4 says that the value you've provided is not apporpriate for the parameter type. What value was provided? Check for line terminator characters in $CommandOutput - you may need to trim them.

Posted: Tue Jul 05, 2005 3:31 pm
by pnchowdary
Hi Ray,

Thanks for the prompt reply to my post. The parameter had some null space embedded in the string. I removed the null space and it worked. Once again thanks for pointing me in the right direction.

Thanks,
Naveen

Posted: Wed Aug 10, 2005 1:12 am
by meorz
Guys, I couldn't see anything inside the "Insert Parameter Value" could you gives me the exact convention to put in the program name and output parameters?

btw, I am using Windows

Thanks a lot

Posted: Wed Aug 10, 2005 1:18 am
by ray.wurlod
Do you have an upstream Execute Command activity? Without that you won't see anything.

Posted: Wed Aug 10, 2005 1:22 am
by meorz
That was unbelieveably fast!

How do check if I have that?

There is only the Header or something (main node) but I can't click anything.

btw, I have a friend working with me here who claims to know you ;)

Posted: Wed Aug 10, 2005 1:58 am
by ray.wurlod
Your job sequence must have, as a very minimum:

Code: Select all

ExecuteCommand  ----->  JobActivity
I believe yours does not.
When it does, and the Execute Command activity's properties have properly been filled in, you can do what was described above.