Page 1 of 1

How to call a .ksh from a before/after routine

Posted: Fri Aug 24, 2007 8:53 am
by dcguuenther
Hello.

I have written a .ksh script which will invoke several dsjob commands, but in general, it will accept project name, job name, email address as its arguments, and will retrieve the job log and email the job log, as well as any dependent job in an aborted states log to the email.

I currently run this on demand, however I would like to find a simple way to automate this when a job fails. I would like to use a before/after job routine on my top level sequencer that will perform this when the sequencer finishes. I'd rather use this then an execute command stage.

I am sure I can figure out how to code a routine, but would prefer not to have to read the docs on all of the available functions. Does anyone know which function I would call from my routine in order to invoke the .ksh.

in general, I want to envoke the below

#SCRIPT_DIR#/#SCRIPT_NAME# #PROJ_NAME#, #JOB_NAME#, #EMAIL#

which could translate to /home/job_retrieval.ksh Proj_1 Job_1 anyone@email.net

Thanks

Posted: Fri Aug 24, 2007 9:03 am
by mohdsuf
Hello,
In the job properties in general section, from "After job subroutine" select
ExecSH and in the input value put the below hashed words where the capital letter words are the job parameters.
#SCRIPT_DIR#/#SCRIPT_NAME# #PROJ_NAME#, #JOB_NAME#, #EMAIL#

Posted: Fri Aug 24, 2007 9:29 am
by dcguuenther
Boom!!! Gosh that is simple. Thanks a ton.

Posted: Fri Aug 24, 2007 10:13 am
by mohdsuf
remove commas from this also
#SCRIPT_DIR#/#SCRIPT_NAME# #PROJ_NAME#, #JOB_NAME#, #EMAIL#

Posted: Tue Aug 28, 2007 7:41 am
by dcguuenther
After Job Routine only seems to be available from a job, not a sequencer. Is that correct?

I really don't want to use ExecSh script from Sequencer since the job log will not be complete because the job is still running. Is my only choice to call this from the aix script that runs the job?

Posted: Tue Aug 28, 2007 8:18 am
by mohdsuf
If you want to use your script after job sequencer in a SEQUENCE job then you can use it with the help of ROUTINE ACTIVITY(RA) stage . Just place RA after the sequencer stage , choose ExecSH from the drop down routine name.
In the input argument column

use this
SCRIPT_DIR:"":SCRIPT_NAME:" ":PROJ_NAME:" ":JOB_NAME:" ":EMAIL:

When you run the job then for parameter SCRIPT_DIR
give path name as /dir1/dir2/
Make sure you give the last forward slash '/', which will consider the SCRIPT_NAME after that in one complete path and your other parameters as argument of the shell script.

Try this.