Page 1 of 1

ExecSH using after-job subroutine

Posted: Tue Dec 12, 2006 11:12 pm
by abc123
I have a job activity in a sequencer. I would like to run an after-job subroutine for the job. I am going to use the ExecSh command to run a shell script. A parameter needs to be passed to the shell script. Will I be able to do something like:

execSH("ksh MyShell.ksh Prm1")? How do I pass the parameter?

Thanks.

Posted: Wed Dec 13, 2006 12:05 am
by narasimha
Select ExecSH from the after job subroutine from the job you want it to run after.
In the Input Value, cd to the location of your script and run your script.

Ex

Code: Select all

cd /script_location; PPMyShell.ksh Prm1
Or you could also an Execute Command sequence in your Job Sequence after the Job Activity , but here you will have to pass the parameters in the "Parameter" text box.

Posted: Wed Dec 13, 2006 1:20 am
by ray.wurlod
To run ExecSH itself as the after-job subroutine, simply put the command line argument after the command pathname in the Input Values field.

To call ExecSH from your own routine you need simply add the command line argument to the command line issued.

If you mean "job parameter" here, rather than command line argument, use a job parameter reference (surrounded by "#" characters) following the command pathname in the first case. In the second case, determine the value of the job parameter using DSGetParamInfo() and build the command line using that value.

Posted: Wed Dec 13, 2006 3:40 pm
by abc123
ray, I put the following in the Input Value:

ksh scriptname.ksh parameter1

I don't get any error but it doesn't do what it is supposed to do. However, when I copy the string from Director and execute it, it works fine. Any ideas?

Posted: Wed Dec 13, 2006 3:48 pm
by narasimha
Where does your script reside?
You need to go to that particular directory and then execute it.
cd to that location, then execute your script.(Hope you are doing that)
You dont need the ksh in front of the script, you could just execute it like below

Code: Select all

scriptname.ksh parameter1 

Posted: Wed Dec 13, 2006 4:58 pm
by abc123
Ok. I found the solution. My script did not have a return at the end which was causing this.

Posted: Wed Dec 13, 2006 5:53 pm
by narasimha
abc123 wrote:Ok. I found the solution. My script did not have a return at the end which was causing this.
I guess you can mark this as resolved now :wink: