Subject: ftp via cron

From: Kevin Dell <[email-masked]>
Date: Fri, 19 Dec 1997 11:45:11 -0000

Can anyone help me.

First things first. At the present time I DON'T use wu-ftpd (YET) I have a multitude of Sun Sparcs with Solaris 2.5.1. I have a requirement to copy (ftp) binary files(actually BLOBS) from a network of Sparcs to a server at night and would need to get FTP to run automatically via a shell script/cron.

I've tried various ways, but I can't get it to work, 
All I want to do is to run it unattended. ftp to a server, log in (as a user), cd to a directory change to binary mode and then "mget *". but I'm stuck. 

Anyone able to help?
regards
Kevin J.Dell

---

From: Manfred Luckmann <[email-masked]>
Date: Fri, 19 Dec 1997 13:43:56 +0100

> Can anyone help me.

sure

> All I want to do is to run it unattended. ftp to a server, log in (as a user), cd to a directory change to binary mode and then "mget *". but I'm stuck.

first of all you have to use a .netrc file (RTFM)
then you can put your ftp commands in a here document 

example:

contents of ~/.netrc (only relevant line shown,
note access rights of ~/.netrc _must_ be -rx------- !):

machine your_ftp_server login your_login password your_password

sample shell script to be called from cron:

ftp -i your_ftp_server <<END_HERE_DOCUMENT
cd your_dir
bin
mget *
END_HERE_DOCUMENT

hope this helps

Manfred
-- 
____________________________________________________________________
Manfred Luckmann                  EMail: [email-masked]
Tel:+49 89 542166-16  Fax:+49 89 5430392   WWW: http:/www.dynamic.de
Dynamic Software GmbH,  Hess Strasse 56,  D-80798 Muenchen,  Germany

---

From: Juergen Christoffel <[email-masked]>
Date: Fri, 19 Dec 1997 14:19:31 +0100

Date: Fri, 19 Dec 1997 11:45:11 -0000
   From: Kevin Dell <[email-masked]>

   Can anyone help me.

Kevin,

you don't have to use shell scripts at all. Take a look at the Mirror
package written in Perl instead. It's used by various sites to
synchronize large mirror archives and it should easily do your job.
You'd have to install it (and Perl of course) on your server just
once. To quote from its' README file:

   Mirror is a package written in Perl that uses the ftp protocol to
   duplicate a directory hierarchy between the machine it is run on
   and a remote host.  It avoids copying files unnecessarily by
   comparing the file timestamps and sizes before transfering.
   Amongst other things it can optionally compress, gzip, and split
   files. 
   
   It was written for use by archive maintainers but can be used by
   anyone wanting to transfer a lot of files over ftp. 

I use it here at GMD to get stuff from local machines onto our
official ftp server. You'll find everything you'll need on a CPAN
archive site near you or you can get the mirror package directly from
ftp.gmd.de:/packages/CPAN/scripts/ftpstuff/mirror-2.8.tar.gz

	--jc

-- 
   E-Mail: [email-masked] or one of {ftp,news,[email-masked]
   GMD - German National Research Center for Information Technology

GMD pays for my technical expertise. My opinions probably scare them...

---

From: [email-masked]
Date: Fri, 19 Dec 1997 08:25:59 -0500 (EST)

>  All I want to do is to run it unattended. ftp to a server, log in (as a user), cd to a directory change to binary mode and then "mget *". but I'm stuck. 

Use wget.  It is a GPL'ed web and ftp mirroring utility.  I am using an
rpm package on a Redhat system, which likely won't help you.  I guess
you will need to hunt down the source package.  It is GPL'ed and _VERY_
easy to use.  I run this script nightly:

#! /bin/sh

cd /home/ftp/pub/linux
/usr/bin/wget -cm ftp://ftp.redhat.com/pub/redhat/redhat-5.0/updates/noarch/
/usr/bin/wget -cm ftp://ftp.redhat.com/pub/redhat/redhat-5.0/updates/i386/

Cheers!
Ty

-- 
Tyson D Sawyer                     Real World Interface, Inc.
Senior Systems Engineer            Robots for the Real World
[email-masked]                   http://www.rwii.com/

---

From: Michael Brennen <[email-masked]>
Date: Fri, 19 Dec 1997 08:46:50 -0600 (CST)

Please set wrap on your mailer to about column 70.

There is 'line ftp' that works well with linux, probably with solaris. 
The description is below. 

I would suggest a different approach, ssh with rsync.  ssh gives
securely authenticated and encrypted sessions (can be unattended with
RSAAuthentication), and rsync does a differential transfer to move
only the data needed.  It works well for what you want.

http://www.ssh.fi/
ftp://samba.anu.edu.au/pub/rsync/

   -- Michael

On Fri, 19 Dec 1997, Kevin Dell wrote:

> have a multitude of Sun Sparcs with Solaris 2.5.1. I have a
> requirement to copy (ftp) binary files(actually BLOBS) from a
> network of Sparcs to a server at night and would need to get FTP to
> run automatically via a shell script/cron. 

Title:          LFTP command line ftp client
Version:        0.11.0
Entered-date:   10APR97
Description:    LFTP is a shell-like command line ftp client. The main
                two advantages over other ftp clients are reliability
                and ability to perform tasks in background. It will
                reconnect and reget the file being transferred
                if the connection broke. You can start a transfer
                in background and continue browsing on the ftp site.
                It does this all in one process. When you have started
                background jobs and feel you are done, you can just
                exit lftp and it automatically moves to nohup mode
                and completes the transfers. It has also such nice
                features as reput and mirror.
Keywords:       ftp client, readline, reliable, background, parallel
Author:         [email-masked] (Alexander V. Lukyanov)
Maintained-by:  [email-masked] (Alexander V. Lukyanov)
Primary-site:   ftp.yars.free.net /pub/software/unix/net/ftp/client
                365 kB lftp-0.11.0.tar.gz
Alternate-site: sunsite.unc.edu
/pub/Linux/system/network/file-transfer
Platforms:      Unix, G++
Copying-policy: GPL

---

From: "Gregory A. Parmer" <[email-masked]>
Date: Fri, 19 Dec 1997 09:03:37 -0600 (CST)

On Fri, 19 Dec 1997, Kevin Dell wrote:
><snip...>

Kevin,
  FWIW--Are you familiar with "/usr/bin/rdist"? It uses a Distfile like
the following to distribute to multiple clients...

# 
# By Role 
# 
SERVERS = ( mailserver newservers )

X11:  
  /export/vol/X11R4 -> ${SERVERS}
       install /export/vol2/X11R4 ;

Could be an alternative.
-greg

---

From: Emil Isberg <[email-masked]>
Date: Fri, 19 Dec 1997 16:25:05 +0100 (MET)

>Use wget.  It is a GPL'ed web and ftp mirroring utility.  I am using an

Get to the source of most gnu software ..
ftp://prep.ai.mit.edu/pub/gnu/wget-1.4.5.tar.gz

:-)

-- 
/Emil
Running on overtime.

---

From: Kent Landfield <[email-masked]>
Date: Fri, 19 Dec 1997 10:22:31 -0600 (CST)

Wow. I am seriously amazed at the numbers of different messages all
describing different means to mirror files. ;)

Let's see... 

rdist 
'line ftp'
rsync with ssh
wget
plain ftp with a .netrc file
mirror

;)

It really depends on what you want to do and where you want to get it from.
If you have perl installed and you will be getting everything from an ftp 
server I'd suggest the use of mirror.  Nice and easy. (I like things that 
way.) Many of the largest archives use mirror.

	http://sunsite.doc.ic.ac.uk/computing/archiving/mirror/

If you need to protect the transmission you might want to look into
other options that include encryption capabilities.  (I personally
like ssh and rsync).

If you are going to be mirroring both from an ftp site and a web site 
then check out wget.

-- 
Kent Landfield                        Phone: 1-817-545-2502             
Email: [email-masked]             http://www.landfield.com/
Email: [email-masked]                   http://www.nfr.net/
Please send comp.sources.misc related mail to [email-masked]
Search the Usenet Hypertext FAQ Archive at http://www.faqs.org/faqs/