Tuesday, August 18, 2009

run a command in solaris from winodw and output will save in window through batch file

Hi All,

some time we need to run some command in solaris or Unix machine and need to collect output in window.
This all can be automated and directly we can invoke a shell scrpit in solaris from windows. You need putty to do this. Your shell script should be in windows machine.

CODE:

Create a batch file (suppose putty is saved in d: drive of windows and your shell script that you want to run is saved in d: drive).shell script name is "shellscript.sh"


D:\putty -ssh username@servername -pw mypassword -m "D:\shellscript.sh"
ftp -i -s:"D:\ftp.txt"



now create a ftp.txt file in D: drive as follows

OPEN servername
username
password
get filename
BYE




Thanks
Shashank