Page 1 of 1

how to call an unix script in sequence job

Posted: Wed Apr 25, 2007 4:59 am
by sjordery
Hi all,

Can anybody suggest me how to call a unix script in the job sequence.
In the 1st job I am sending one databas table to a file.
Then I have to call an unix script to operate on that file.

Re: how to call an unix script in sequence job

Posted: Wed Apr 25, 2007 5:32 am
by sniper80
you can use a execute command stage after the job that loads the data from DB into your file and then to call your .sh along with respective parameters.

Posted: Wed Apr 25, 2007 6:48 am
by ivannavi
...Or you can call your script within the very same job as an "After-job subroutine" (job properties, General tab)

Posted: Wed Apr 25, 2007 6:53 am
by sjordery
Hi ,

I have to perform the sequence job bcz there is another job which will remove one file after executing the script.

In the exec command stage I tried basic unix commands like rm,cp and its working fine,but to execute the unix script while giving sh /data/script1.txt command I am not geting the result.

If I have to use ExecSh after job sub routine then what what parameters I have to pass?

can anybody suggest?

Posted: Wed Apr 25, 2007 6:56 am
by chulett
What result are you getting? :?

You don't need the 'sh' part on the front, simply put the fully pathed script in the Command box and then any parameters / arguments (if needed) in the Parameter box.

Run the job and then post whatever messages in the log relate to that stage.

Posted: Wed Apr 25, 2007 7:35 am
by sjordery
Hi Craig,

In the log it is showing that sequence job is finished.
But the script is not getting executed.
I am able to run the script in the unix env and getting the result properly.

This is the log report I am getting.

----------------------------------------------------------------
mail_alert_seq..JobControl (@Execute_Command_11): Executed: /data/skscript
Reply=0
Output from command ====>
cat: skey.txt: No such file or directory.
----------------------------------------------------------------

Its showing skey.txt file not found but file is there and I am able to execute the script in the unix env.

Can you suggest what is wrong here?
Is there any other way to run the script?

Posted: Wed Apr 25, 2007 7:41 am
by DSguru2B
Within the script, use fully qualified paths for any file you write to or reference. Your script is complaining that skey.txt is not present. Ofcourse not, the dsengine will look for this file in its home directory. Your script works from command line because skey.txt might be present in /data/ directory, the same as the script and hence it finds it and the script executes.

Posted: Wed Apr 25, 2007 8:06 am
by sjordery
I gave full path for the file skey.txt in the unix script.
Then after running the sequence I am getting following log report.

--------------------------------------------------------------------------------
mail_alert_seq..JobControl (@Execute_Command_11): Executed: /data/skscript
Reply=126
Output from command ====>
SH: line 1: /data/skscript: Permission denied
-----------------------------------------------------------------------------
nw its showing permission denied for the script.

Posted: Wed Apr 25, 2007 8:18 am
by DSguru2B
Can you execute it from unix using the same id? If yes then try giving the command as

Code: Select all

. /data/skscript 

Posted: Wed Apr 25, 2007 8:54 am
by rafik2k
First give execute permision of the script to the user and check.
You can also check by giving full permision like chmod 777

Posted: Wed Apr 25, 2007 10:31 pm
by sjordery
Hi,

Thanks to all.
I gave the command as . /data/script and 777 permission to the script.
Its working fine now.