Page 1 of 1

Command line processing on remote server

Posted: Sat Sep 24, 2005 11:58 pm
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!

Posted: Sun Sep 25, 2005 1:37 am
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,

Posted: Sun Sep 25, 2005 7:58 am
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

Posted: Mon Sep 26, 2005 8:04 am
by roy
Is there any difference between the user the process runs under and the one you'r using when you manualy run it?

Posted: Mon May 05, 2008 11:47 am
by Rwe
Is there an answer to this question? I have the same issue.

Thanks!

Posted: Mon May 05, 2008 8:52 pm
by Minhajuddin
Yes there is. But, you need to answer Roy's question for that.

Posted: Tue May 06, 2008 7:32 am
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

Posted: Tue May 06, 2008 9:27 am
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.

Posted: Tue May 06, 2008 12:39 pm
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!