Dear Sun Managers,
Thanks for the responses, many useful suggestions, but 10 seconds after
I posted my message, I worked it out!
Original message:
Dear Sun-managers,
> I need to ftp a file between two machines at a specified time each
> night. I can't put NFS or any 'R' commands on these machines for
> security reasons. So I need to get cron to execute a script which will
> automatically invoke ftp with the right parameters, and autologin and
> get the file and then exit. I have looked at the man pages, and they
> refer to macros, but they don't seem to be stored anywhere. Could any
> sun managers help me out here, all help will be acknowledged.
Thanks to all who replied.
Dave Staggs.
Ric Anderson.
Michael Clarkson.
Bert Shure.
Chris Barnard.
Mark Carey.
The solution is of course to use a ~/.netrc file which contains
somthing like
machine ftp.microsoft.com login bill password microsoftsucks
#logs bill into 'ftp.microsoft.com' with passwd microsoftsucks
#Note PLAINTEXT PASSWORD !!!!!!
macdef init #defines an ftp macro
cd pub
binary
get myfile.zip
quit
Thanks for the useful tips at:
http://expect.nist.gov #great automation tool!
ftp://ftp.uu.net/networking/archival/mirror/mirror-2.8.tar.gz #auto
mirrors ftp dirs.
http://www.probe.net/~mgleason/ncftp/ #public domain ftp server.
echo "user username passwd\nbinary\ncd /my_dir\nget my_file\n" | ftp -n
other_server
This redirects your the contents of the echo into ftp. This could be
useful as a start for longer scripts.....
Or here is a little perl if you need to build up some scripts....
This alows the use of variables, so that you could get or put files
according to
some set of conditions.
open FTP, "|/usr/bin/ftp >/dev/null 2>&1 192.1.1.1" || die "ERROR";
sleep 2;
print FTP "username_here\n"; sleep 1;
print FTP "password_here\n"; sleep 1;
print FTP "cd F:\n"; sleep 1;
print FTP "cd /scii/liveweb\n"; sleep 1;
print FTP "ascii\n"; sleep 1;
print FTP "put $sc2name liveweb.imp\n"; sleep 1;
print FTP "quit\n";
Thanks for the responses.
Simon Convey.
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:48 CDT