Problem Running SSH2 on Windows Datastage server

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
DJRH
Premium Member
Premium Member
Posts: 23
Joined: Fri Jul 07, 2006 9:03 am
Location: Mississauga

Problem Running SSH2 on Windows Datastage server

Post by DJRH »

Please help as I am having issue running "ssh2" command through "DSEXECUTE" on windows datastage sever. This is what i am trying to do.

I have to run a batch file on a target server and the command i am running from datastage is as follows.


BuildCmd = "ssh2 " : Target_IP_Parm: " -v '" : NT_COMMAND_Parm:"'"
example = ssh2 <TargetSever IP> -v c:\ss.bat

Call DSExecute("NT", BuildCmd , CmdOutput, CmdRetCode)
Call DSLogInfo(" *** CmdOutput contains :" : CmdOutput , "")
Call DSLogInfo(" *** CmdRetCode contains :" : CmdRetCode, "")


The above mentioned command in the datastage job is executing the batch file on the target server sucessfully through SSH2

The problem is that the output generated when the batch file is exected is not getting captured in "CmdOutput ". and throwing the error as below.

Authentication successful.
Could not run stdio

We need to capture the output of the batch file for error handling to make sure the batch file finished sucessfully on the target server.

The batch file on the target server does not return any success or failure code thus we cannot make sure the batch file finished successfully or not on the target server.

I also tried writing the output of the "ssh2" command to a file but got the same error.

I would appreciate if somebody can advise me on this issue or if somebody has come across the similar issue.
rohit1231
Participant
Posts: 6
Joined: Wed May 02, 2007 2:34 pm

Re: Problem Running SSH2 on Windows Datastage server

Post by rohit1231 »

Not sure if I understand this correctly :? , you would like to submit a batch script on some remote WIN server (SERVER 2) through the DataStage Engine, again on a WIN box, which is on a different machine (SERVER 1) :?:

Does the ssh2 command successfully initiate this batch script on SERVER 2 when submitted directly through the command line and NOT through the DataStage Engine on SERVER 1 ?
DJRH
Premium Member
Premium Member
Posts: 23
Joined: Fri Jul 07, 2006 9:03 am
Location: Mississauga

Re: Problem Running SSH2 on Windows Datastage server

Post by DJRH »

rohit1231 wrote:Not sure if I understand this correctly :? , you would like to submit a batch script on some remote WIN server (SERVER 2) through the DataStage Engine, again on a WIN box, which is on a different machine (SERVER 1) :?:

Does the ssh2 command successfully initiate this batch script on SERVER 2 when submitted directly through the command line and NOT through the DataStage Engine on SERVER 1 ?
I am submitting the ssh2 from DataStage Engine which is on WIN box (SERVER 1) to different machine (SERVER 2) which is a WIN box as well.

ssh2 command successfully initiate the batch script on SERVER 2 and generates and capture the output but through DataStage It does not capture the output but do generates the script on target server (SERVER2)
DJRH
DJRH
Premium Member
Premium Member
Posts: 23
Joined: Fri Jul 07, 2006 9:03 am
Location: Mississauga

Re: Problem Running SSH2 on Windows Datastage server

Post by DJRH »

Can anybody advise on this issue...???
DJRH
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Try using

Code: Select all

EXECUTE 'DOS -c "':BuildCmd:'"' CAPTURING CmdOutput RETURNING CmdRetCode
Call DSLogInfo(" *** CmdOutput (":Len(CmdOutput):" chars) contains :" : CmdOutput , "") 
Does the output look different? Is the length of CmdOutput greater than 0?
DJRH
Premium Member
Premium Member
Posts: 23
Joined: Fri Jul 07, 2006 9:03 am
Location: Mississauga

Post by DJRH »

ArndW wrote:Try using

Code: Select all

EXECUTE 'DOS -c "':BuildCmd:'"' CAPTURING CmdOutput RETURNING CmdRetCode
Call DSLogInfo(" *** CmdOutput (":Len(CmdOutput):" chars) contains :" : CmdOutput , "") 
Does the output look different? Is the length of CmdOutput greater than 0?

I tried the above code you sent and this is what i got, mentioned below

CmdOutput (127 chars) contains :Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.
d:\programs\Ascential\DataStage\Projects\epmdev1>


The output is not what i want . The actual output is the content of batch file which get listed when the batch file is executed and that also has a string called "process completed sucessfully" and thats what i need to capture to make sure that the batch file on the target server finished successfully.
DJRH
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

ssh2 executes a script on SERVER2. The output of ssh2 is on SERVER2. You must organize to get that output back to SERVER1 - perhaps using FTP.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DJRH
Premium Member
Premium Member
Posts: 23
Joined: Fri Jul 07, 2006 9:03 am
Location: Mississauga

Post by DJRH »

ray.wurlod wrote:ssh2 executes a script on SERVER2. The output of ssh2 is on SERVER2. You must organize to get that output back to SERVER1 - perhaps using FTP.
We thought doing the same but using FTP is a policy violation in the organization.
DJRH
Post Reply