Dear Sun Managers,
Thanks for the responses, many useful suggestions, but 10 seconds after
I posted my message, I worked it out!
> 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.
The solution is of course to use a ~/.netrc file which contains
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
Thanks for the useful tips at:
http://expect.nist.gov #great automation tool!
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
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
some set of conditions.
open FTP, "|/usr/bin/ftp >/dev/null 2>&1 184.108.40.206" || die "ERROR";
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.
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:48 CDT