ftp in shell script from linux to windows XP


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users ftp in shell script from linux to windows XP
# 1  
Old 08-24-2011
ftp in shell script from linux to windows XP

Hi,

I have 9 different linux based servers and i am automating there healthcheckup by doing ssh and fetching deviations out of it in a single text file. I am doing so by using ssh keygen. I am done with the above part .

Now i want to ftp that text file to my windows XP desktop and i want to do that in the same shell script. Smilie
FTP is availaible on both sides
Is it possible to do so.........


Thanks in advance

gemnian.g
# 2  
Old 08-24-2011
You'll need to do something similar to this, setting your variables:
Code:
echo "ftp -n ${HOST} <<EOF" > ${FILE_FTP}
echo "quote user ${USER}" >> ${FILE_FTP}
echo "quote pass ${PASS}" >> ${FILE_FTP}
echo "ascii"  >> ${FILE_FTP}
echo "put ${DIR_ORIGEN_FILES}/${FILE} ${DIR_DESTINO_FILES}/${FILE}"  >> ${FILE_FTP}
echo "by" >> ${FILE_FTP}
echo "EOF" >> ${FILE_FTP}

chmod 755 ${FILE_FTP}

${FILE_FTP}


Last edited by pludi; 08-24-2011 at 05:23 AM..
# 3  
Old 08-24-2011
There are couple of alternatives, you can choose from:
  • You can directly mail o/p of healthcheck to your mail ID.
  • You can setup ssh key authentication between your desktop and linux servers.
  • Instead of going through scripts, you can configure network monitoring tools like MRTG, cacti or Nagios.
# 4  
Old 08-29-2011
You can also do a samba mounting. In that case you don't need to do any ftp. Put the output in a pre configured samba mounted directory in your linux server and then the output will be available to your desktop.
# 5  
Old 08-29-2011
Quote:
Originally Posted by poyeur
You'll need to do something similar to this, setting your variables:
Code:
echo "ftp -n ${HOST} <<EOF" > ${FILE_FTP}
echo "quote user ${USER}" >> ${FILE_FTP}
echo "quote pass ${PASS}" >> ${FILE_FTP}
echo "ascii"  >> ${FILE_FTP}
echo "put ${DIR_ORIGEN_FILES}/${FILE} ${DIR_DESTINO_FILES}/${FILE}"  >> ${FILE_FTP}
echo "by" >> ${FILE_FTP}
echo "EOF" >> ${FILE_FTP}

chmod 755 ${FILE_FTP}

${FILE_FTP}

Creating a file and running it is a bit inelegant, why not just run the command in the first place?

Code:
ftp -n $HOST <<EOF
quote user "$USER"
quote pass "$PASS"

...and so on.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Copy files from Linux server local windows machine using a shell script

Hello, I need to create a shell script which will copy files - which are created on particular date and starting with particular name - to local windows XP machine. Is this possible.? Currently it is being done manually using winscp (1 Reply)
Discussion started by: NarayanaPrakash
1 Replies

2. Shell Programming and Scripting

FTP from Unix Shell script to Windows Shared folder ?

Hi Before Posting my query in this forum, I have gone through various similar postings to get some idea on ftp and how to do that from unix shell script to windows server. My question is related to FTP'ing from Unix to windows shared folder My basic question is 1. Is it possible to do FTP... (4 Replies)
Discussion started by: shekharjchandra
4 Replies

3. Shell Programming and Scripting

shell script to ftp the files from windows to unix server

Hi, I need to ftp some input files from windows to unix server.All the files will be saved in the C drive in my machine. Currently all these files are transferring manually to the unix server.I need to write a shell script which ftp the files from windows to unix box.When I searched in the... (10 Replies)
Discussion started by: kavithakuttyk
10 Replies

4. UNIX for Advanced & Expert Users

Shell script to ftp files from windows to unix

Hi , I need to ftp some input files from windows to unix server.All the files will be saved in the C drive in my machine.Currently all these files are transferring manually to the unix server.I need to write a shell script which ftp the files from windows to unix box.When I searched in the forum i... (1 Reply)
Discussion started by: kavithakuttyk
1 Replies

5. Shell Programming and Scripting

ftp file starting with particular name on Windows box to Unix box using shell script

Hello all ! I'm trying to write a shell script (bash) to ftp a file starting with particular name like "Latest_" that is present on a Windows box to UNIX server. Basically I want to set this script in the cron so that daily the new build that is posted on the Windows box can be downloaded to the... (2 Replies)
Discussion started by: vijayb4u83
2 Replies

6. Shell Programming and Scripting

FTP from unix shell script to windows

Hi, I m trying to connect/establish FTP from unix shell script to my PC.Below the script i have written #!/bin/ksh ftp -v -n ddcappip01.com << "EOF" user Amit jason bye EOF ------------------------------ERROR-------------------------- but i m getting the below error for the... (4 Replies)
Discussion started by: ali560045
4 Replies

7. UNIX for Advanced & Expert Users

Executing shell script from Windows FTP

Hello, Any inputs on the possibility of executing a shell script on unix box from Windows FTP TIA (1 Reply)
Discussion started by: B2BIntegrator
1 Replies

8. Shell Programming and Scripting

FTP from Linux to windows server by shell script

Hi, Please advice whether my below requirement is feasible, My requirement : Automated FTP from linux server to windows server using a shell script on every monday. If feasible, please help me how to do this ? Thanks in advance (2 Replies)
Discussion started by: apsprabhu
2 Replies

9. Shell Programming and Scripting

Shell Script to ftp from windows server

Hello All, I've to write a shell script to transfer some files to/from windows server. I can put & get files simply by doing ftp but need to automate this. So I tried for this -. HOST=.hostname USER='username' PASSWD='***' ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS... (8 Replies)
Discussion started by: shilpa.rajput
8 Replies

10. Shell Programming and Scripting

FTP Unix Box to Windows Shell Script

Hello All, Could someone help me out with this? I want to incorporate this into an existing script so the output of a SAS job can be ftp'd from our UNIX box to a directory on a drive in Windows environment. Can this be done with no extra third party software? We currently use Putty for copy... (2 Replies)
Discussion started by: Jose Miguel
2 Replies
Login or Register to Ask a Question