ftp script?

Kenneth Goodwin kgoodwin at datamarktech.com
Tue Dec 14 16:30:28 UTC 2004


>  -----Original Message-----
>  From: redhat-install-list-bounces at redhat.com
>  [mailto:redhat-install-list-bounces at redhat.com]On Behalf
Of Harold
>  Hallikainen
>  Sent: Tuesday, December 14, 2004 11:15 AM
>  To: redhat-install-list at redhat.com
>  Subject: ftp script?
>
>
>  I'm trying to have ftp send a file to another machine in
a
>  shell script
>  called by cron. After Googling around, reading various
man
>  pages, etc., it
>  looks like I've gotten the script to log in properly by
>  setting up stuff
>  in .netrc , but I'm still having trouble sending the cd
and
>  put commands
>  into ftp from the script. Can anyone give me some clues?
>  This is running
>  on an RH8 machine.
>

You can have your shell script dynamically create each time
a NETRC file
to do want you want to do at that instance and then call the
FTP command for that system name.

Or you can First put everything that is always going to be
the same
into a static NETRC file entry for that system
IE. everything you want it to do everytime you connect as
long as you
can do these things prior to your "unique" stuff that has to
be
generated on the fly. typially - login, password, chdir's

Then  to do the custom stuff, you have the shell script
composite a string or build a temp file
to act as STDIN to the ftp commmand.

quick off the top of my head example of the latter
to give you the general idea,
check the ftp man pages for ftp flags and proper commands

	echo "cd stored_data.d\nput ${MYFILENAME}\nquit" | ftp -i
systemname

	or

	echo "cd ${TARGET1}" > my_ftptemp_file
	for fname in my_data_files*
	do
		echo "put $fname" >> my_ftptemp_file
	done
	echo "quit" >> my_ftptemp_file

	cat my_ftptemp_file | ftp -i systemname




>  THANKS!
>
>  Harold
>
>  --
>  FCC Rules Updated Daily at http://www.hallikainen.com
>
>  _______________________________________________
>  Redhat-install-list mailing list
>  Redhat-install-list at redhat.com
>
https://www.redhat.com/mailman/listinfo/redhat-install-list
>  To Unsubscribe Go To ABOVE URL or send a message to:
>  redhat-install-list-request at redhat.com
>  Subject: unsubscribe
>




More information about the Redhat-install-list mailing list