Can rsh command be used to call a bat file

I have a .bat file on windows, which converts a .xls file into .csv file and using a ksh script i would usually FTP this .csv file...

Now i want to trigger this .bat form my ksh script.

can i use rsh command in my FTP to run .bat file on windows and then ftp the generated .csv file...is this possibel..

If so please explain me...

Thanks..

Nope. Windows usually does not provide any remote administration service that isn't graphics based. You could try to install OpenSSH or Telnet on the Windows server to remote in and start the batch file.

I have Telnet using which i connect to the Unix and do my work...
can you say me more about how i can use telnet, unix to start my batch file

You would have to have telnet server running on the windows box and create a script to connect to the windows box and run the script....

Why not just use the windows scheduler.

I dont know when i told my team lead she said no

Ok can i use telent in between ftp to start something on windoes like this
telnet C:\test\bhagya.bat in my FTP
will this start my bat file to work and give me the rewuired out put...

FTP will not execute a file on the remote server. FTP is for transferring files, not executing.

Yes... this is my FTP

FTP_FILE_NAME="LTC*.csv"
FTP_DIR_NAME="ProviderReject"
ONE_MORE="SI_Notification_Reports"
PRESENT_DIR=`pwd`
FTP_STATS="${LOG_DIR}/FTP_Provider_Rej.stats"
FTP_ERR="${LOG_DIR}/FTP_Provider_Rej.error"
ftp -nv ${SI_NOTIFICATION_FTP_IP} > ${FTP_STATS} 2> ${FTP_ERR} <<EOF 
user ${SI_NOTIFICATION_FTP_USER} ${SI_NOTIFICATION_FTP_PASSWORD}
cd ${ONE_MORE}
cd ${FTP_DIR_NAME} 
bin
lcd ${DATA_DIR}
pwd
dir
prompt off
mget ${FTP_FILE_NAME}  
mdelete ${FTP_FILE_NAME}
prompt on
dir
EOF

if [[ -f $FTP_ERR ]] && [[ ! -s $FTP_ERR ]]     
then                                            
  rm -f ${FTP_ERR}                              
fi                  

here i am going to that location where the bat file is so can i put my telnet statment to run .bat file like this

cd ${ONE_MORE}
cd ${FTP_DIR_NAME}

Here telenet statement to run bat file

bin
lcd ${DATA_DIR}

bhagya2340,

Can you please elaborate your problem. It seems that you want to put a file from windows box to unix box? and execute from there? Am i correct in saying that?

And after executing the file in UNIX what will happen. Others may provide you better solution if you can give us info.

Cheers!

Alright, tell me if I understood you correctly. You want the script to

  1. Connect to the Windows server to start a batch file, which generates some CSV files
  2. Use FTP to move those files to a UNIX box

If this is correct, you need some way to login to the Windows server that doesn't require a graphic environment, eg. telnet, rsh, ssh. AFAIK some versions of Windows already provide a telnet server, Windows Services for Unix provides an rsh server, OpenSSH for Windows is a subset of the Cygwin installation that provides a SSH server for Windows.

Your script would have to do the following:

  1. Remote to the Windows server
  2. Run your batch file
  3. FTP the results

Note that you have to start the batch file before you start the FTP session, as FTP can't run any host commands.

You are right.... the problem is that i dont know how to do first 2 steps... I have telnet on my system... can you say me how i can get connedted to my remote windows server and run my batchfile....
I can FTP the results... thats not the problem...

It doesn't matter if you have telnet on your box or not, the Windows server has to provide some means for remote login. Choose one of telnet/rsh/ssh and install the appropriate server on Windows.

Thanks a lot... I know ypu are trying to help me... but no new softwares cannot be installed in my system.
If i can also the code will work on my sytem but when it goes to Production it will not as they dont have the software...so...
Is there an possible way that i can just open a .xls file on windows using FTP of Unix...

Actually i have written a macro in my .xls it runs if the file is just opened... so is there a possible way to just open it so it produces the required .csv file....

No. FTP is file transfer only. To open the .xls file you would have to invoke a command on the Windows server, which isn't possible.
The only alternative I see is to move execution control to the Windows server. Run your batch file there, and when it's done telnet into the unix-box and call the FTP script.

Excatly this how its done now.... Its all manually... we want to automate the process...so we can put it on cron tab at a perticular time...

Anways Thanks... if you this any other way please let me know....

Can you say me how to used rsh command to get connected to remort windows server form unix box and open a file...

Can you run the Windows Batch File as a Windows Scheduled Task?
If so, you could create the .csv on the Windows server and use the Windows command line FTP to transfer the file to the unix server.
Tip: FTP the file under a temporary filename, then rename it with FTP.
On the unix server the next process can run from cron and look to see if a new file has arrived.

I already know this method... but i dont want to or i cant schedule this task on the server... My tead lead said no to this....
Thats why i want to call it from Ksh script....

For the unix box to initiate the bat you will have to have some other software running on the windows box. It can be OpenSSh server, a telnet server, IIS apache or other software.

FTP will NOT do it.

Hi.... I found that we have telnet server... can you say me how i can call this bat file using a Telnet server.. Please say me in detail as i never used telnet server in my code before,... nor have seen any code....

Thanks!

Rsh Runs commands on remote computers running the RSH service or daemon. Windows XP and Windows 2000 do not provide an RSH service. An RSH service called Rshsvc.exe is provided with the Windows 2000 Server Resource Kit. Used without parameters, rsh displays help.

quoted from the ms offical help resources ms-its:C:\WINDOWS\Help\ntcmds.chm::/rsh.htm
thats means it possible to run rsh on win box