Remote Command Tools?

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
gsbrown
Premium Member
Premium Member
Posts: 148
Joined: Mon Sep 23, 2002 1:00 pm
Location: USA

Remote Command Tools?

Post by gsbrown »

Can anyone recommend tools or procedures we can incorporate into DataStage Server jobs to execute a remote command on another server when a DataStage job completes (or via job control language)

We have a DataStage job that builds a source file for an application on another server and that application has an import script (.bat) that needs to run when DataStage has built the source file.

Both our DataStage server and the other application server are Windows 2003. Any ideas?

Thanks,
Greg
dang
Charter Member
Charter Member
Posts: 5
Joined: Thu Oct 28, 2004 8:58 am

Post by dang »

Hi Greg,
Are you familiar with the "Routine Activity" sequence? We use this to issue commands on other servers. We also use it to FTP JCL to the mainframe JES2 system to submit JCL.

Good luck,
Dan
gsbrown
Premium Member
Premium Member
Posts: 148
Joined: Mon Sep 23, 2002 1:00 pm
Location: USA

Post by gsbrown »

Are you referring to the "Routine Activity" stage in a job sequence?
I'm familiar with this and that you use it to execute a preexisting routine in your DataStage project environment.

Do you have a routine that sends remote command executions?

Greg
gsbrown
Premium Member
Premium Member
Posts: 148
Joined: Mon Sep 23, 2002 1:00 pm
Location: USA

Post by gsbrown »

I know how to execute commands locally using DSExecute.
I'm trying execute a command located on a remote server.

I want to run a .bat command on the remote server that initiates a load routine with the remote application. I need this command event triggered based upon the successful completion of the DataStage server job that is creating the source file used by the remote loading application.

For example, SERVER1 is an application server for a sales data inquiry application. On this server is a .bat script that executes several PowerBuilder .exe jobs to process the previous day's sales data out of a database. I want this .bat script to run as soon as I know that the database is loaded with the previous day's sales data. DataStage is located on SERVER2 and contains a server job responsible for loading this sales data on a daily basis. When the DataStage job is complete on SERVER2, then I want to run the .bat command on SERVER1.

I'm interesting in knowing how others are accomplishing this.

Thanks,
Greg
NBALA
Participant
Posts: 48
Joined: Tue Jul 11, 2006 11:52 am
Location: IL, USA

Post by NBALA »

On success of SERVER2 DS Job, Include a routine activity and Use full path for the batch file in the routine .

\\SERVER1.yourdomain.com\Temp\Test.bat

-NB
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

I have done it in the past in the following way. Write a batch file to connect to a remote server and then put or get files from that server. I have use DSExecute API's within a routine to execute this batch file successfully. In your case, I am guessing you will have to write a batch file which connects to the remote server and then calls the required .bat command. Is this what you might be interested in looking at? I have posted a routine couple of weeks back which achieves this. You might want to take a look at it here to get an idea.If you have any questions please let me know.
Kris

Where's the "Any" key?-Homer Simpson
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

You can also do what NBALA has suggested if you dont have to connect to SERVER1 with a username and password.
Kris

Where's the "Any" key?-Homer Simpson
gsbrown
Premium Member
Premium Member
Posts: 148
Joined: Mon Sep 23, 2002 1:00 pm
Location: USA

Post by gsbrown »

The important note that I was trying to make clear is that I want the command to run on SERVER1, not on the DataStage SERVER2.

If SERVER2 executes the command \\SERVER1.yourdomain.com\Temp\Test.bat it will run on SERVER2.

I'll test it, but I don't see how that command submits the processing over to SERVER1. You're just calling a command to run on SERVER2 that's stored on SERVER1.

Thanks for the responses

Greg
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

REMSH, RSH, RLOGIN, SSH, SCP. Check out these commands, as they are available on both Windoze and Unix implementations. You can remote shell login to a server, run a command locally on that machine, and then exit. For secured environments, SSH and SCP are what you could use. For SSH and SCP, you can authorize an RSA-KEY for a user such that you won't need to pass userid and password everytime SCP and SSH are used if they are executed as that specific user going to a specifically authorized machine. Google for more info.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Doesn't a batch file something like this work for you?

Code: Select all

echo open %1 >%0.txt
echo %2>> %0.txt
echo %3>> %0.txt
echo ascii                       >>%0.txt
echo cd path to batch2.bat  >>%0.txt
echo call batch2.bat        >>%0.txt
echo quit                        >>%0.txt

ftp -s:%0.txt > %0.log
del %0.txt
exit
where 1,2,3 are parameters---servername, username, password to log on to remote server respectively.
Kris

Where's the "Any" key?-Homer Simpson
Post Reply