LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] grabbing ftp files remotely...

[ILUG] grabbing ftp files remotely...

Brady, Padraig Padraig.Brady at compaq.com
Fri Nov 19 16:59:31 GMT 1999


Following is a simple script I did to work across firewalls:
I ran it everyday using crontab.

#! /bin/sh

transfer_file1="/etc/data.txt"
transfer_dest_dir="/usr/users/me/data"
num_files=1

##################################################
# These are the necessary pieces of info
# about the machine outside the firewall.
##################################################

outsideFW_host="10.1.1.1"
outsideFW_user="user"
outsideFW_password="pw"

##################################################
# These are the necessary pieces of info
# for the host behind the firewall to transfer
# the files to.
##################################################

insideFW_host="10.1.1.2"
insideFW_user="user"
insideFW_password="pw"

##################################################
# Some bookeeping
##################################################
rm -f ftp_fw_tmp_log #temp file removed

echo ------`date`------ >> $1

##################################################
# Do the file transfer
##################################################
echo "open $insideFW_host
user $insideFW_user $insideFW_password
cd $transfer_dest_dir
proxy open $outsideFW_host
proxy user $outsideFW_user $outsideFW_password
ascii
proxy ascii
proxy put $transfer_file1 `basename $transfer_file1`
quit" | ftp -v -n -i 2>&1 >> ftp_fw_tmp_log
# -n = ignore .netrc file
# -i = turn off interactive prompting
# -v = be more verbose (so can check for correct transfer)

###################################################
# Check the transfer worked OK
###################################################

if test `grep "226 Transfer complete" ftp_fw_tmp_log | wc -l` = `expr 2 \*
$num_files`
then
	echo "..SUCCESSFUL TRANSFER.." >> $1
else
	echo "UNSUCCESSFUL TRANSFER!!" >> $1
fi

> -----Original Message-----
> From: Vincent Cunniffe [mailto:vcunniff at arbgroup.com]
> Sent: 19 November 1999 15:09
> To: ilug
> Subject: [ILUG] grabbing ftp files remotely...
> 
> 
> Right : 
> 
> I have a Solaris box, and a DEC Alpha OpenVMS box, and I want
> to script a filetransfer to the Solaris box from the Alpha.
> 
> Script should run on the Solaris box, and the ideal tool that
> I can think of would be one to snag a specific file per command
> via a *non*-interactive ftp session with the Alpha box. 
> 
> Having the username and password in the script is OK, as it's
> a root-privilege one only.
> 
> Any suggestions for tools?
> 
> Vin
> 
> -- 
> Irish Linux Users' Group: ilug at linux.ie
> http://www.linux.ie/mailman/listinfo/ilug for 
> (un)subscription information.
> List maintainer: listmaster at linux.ie
> 




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell