Command line processing on remote 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
Oferw
Participant
Posts: 2
Joined: Wed Sep 21, 2005 3:20 am
Location: ELAL

Command line processing on remote server

Post by Oferw »

When a condition is met, I need to execute a batch program (SAS) on a remote server. OS on both sides is WIN 2003.
I tried RCONSOLE and PSEXEC.
PSEXEC seems to work if run manually, outside of datastage but when running from within datastage it is rather erratic. Sometimes it runs and sometimes not and I get the message:
"The process tried to write to a nonexistent pipe"
(this I see in the job log).
How do I solve this OR is there another solution (program) that works
for submitting to a remote server a command line command (with username and password as parms).
Thanks!
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi And Welcome aboard :).

How are you running this command line? (there are 3 ways at least that pops to my mind, perhaps even more)

Do you have any fire-wall program closing the open pipe?

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
Oferw
Participant
Posts: 2
Joined: Wed Sep 21, 2005 3:20 am
Location: ELAL

Post by Oferw »

From within Datastage
- Execute command activity the command is...

"D:\prod\tamar\START_TAMAR_C2P_ON_SAS01.bat"

It runs a batch file that does the following:
c:
cd\psexec
psexec \\sas-01 -u campus\sas_scheduler -p xxxxxx D:\SharedData\ETL\tamar_c2p.bat
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Is there any difference between the user the process runs under and the one you'r using when you manualy run it?
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
Rwe
Participant
Posts: 8
Joined: Fri Aug 24, 2007 8:03 am

Post by Rwe »

Is there an answer to this question? I have the same issue.

Thanks!
OCPOracle
Minhajuddin
Participant
Posts: 467
Joined: Tue Mar 20, 2007 6:36 am
Location: Chennai
Contact:

Post by Minhajuddin »

Yes there is. But, you need to answer Roy's question for that.
Minhajuddin

<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
Rwe
Participant
Posts: 8
Joined: Fri Aug 24, 2007 8:03 am

Post by Rwe »

Minhajuddin,

Thanks for the encouraging answer! I want to test how to use psexec
to run a remote command in another machine. I created a Execute Command stage and the command is:

'D:\Lab\TestPsExec.bat'

It runs a batch file that does the following:

cd D:\Lab
psexec.exe \\remotemachine -d "D:\Lab\TestPsExec2.bat"
EXIT 0

Inside TestPsExec2.bat, it runs simply "echo 0".

Sometimes if I run it through Director, it works. But if I schedule it to run, e.g. 9 a.m, it never stop and the status is always 'Running/Restartable'.
If I run it through Designer, it has the same issue, that is, the status is always in 'Running/Restartable' status.

I am not sure how Execute Command stage interact with PSEXEC.

Thank you very much for further advice!

Rwe
OCPOracle
Minhajuddin
Participant
Posts: 467
Joined: Tue Mar 20, 2007 6:36 am
Location: Chennai
Contact:

Post by Minhajuddin »

It's always better not to use interactive processes when you test something using scripts in datastage. There might not be a problem at all with your script.

I am not a pro at psexec (Just downloaded, and checked it). A few observations:

1) Is your D:\Lab\TestPsExec2.bat on the remote server?
2)
Inside TestPsExec2.bat, it runs simply "echo 0".
Instead of doing an echo. Try to test it using a command which is non-interactive (e.g. touch D:\Touched_by_psexec.txt). This will give you something definite to go and check on the remote server.
3) I don't see the login credentials being passed in the command.
4) Finally, if nothing of this works, check the user through which this script is being run in datastage director log.
Minhajuddin

<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
Rwe
Participant
Posts: 8
Joined: Fri Aug 24, 2007 8:03 am

Post by Rwe »

>1) Is your D:\Lab\TestPsExec2.bat on the remote server?
Yes

> 2)
Inside TestPsExec2.bat, it runs simply "echo 0".
> Instead of doing an echo. Try to test it using a command which is non-> interactive (e.g. touch D:\Touched_by_psexec.txt). This will give you > something definite to go and check on the remote server.
Agree.

> 3) I don't see the login credentials being passed in the command.
This is the reason.

Thanks for the great help!
OCPOracle
Post Reply