Page 1 of 1

Remote Command Tools?

Posted: Mon Aug 21, 2006 8:00 am
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

Posted: Mon Aug 21, 2006 8:18 am
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

Posted: Mon Aug 21, 2006 11:26 am
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

Posted: Mon Aug 21, 2006 2:23 pm
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

Posted: Mon Aug 21, 2006 2:27 pm
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

Posted: Mon Aug 21, 2006 2:32 pm
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.

Posted: Mon Aug 21, 2006 2:38 pm
by kris007
You can also do what NBALA has suggested if you dont have to connect to SERVER1 with a username and password.

Posted: Mon Aug 21, 2006 5:54 pm
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

Posted: Mon Aug 21, 2006 7:31 pm
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.

Posted: Tue Aug 22, 2006 10:56 am
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.