Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Automatic downloading by using cron ?
@ 1998-12-16  5:00 Nguyen-Dai Quy
  1998-12-16  5:00 ` Timothy J. Lee
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Nguyen-Dai Quy @ 1998-12-16  5:00 UTC (permalink / raw)


Hi,
Howto download a file via ftp (anonymous) automatically by using
crontab ?
I try in my cron file:
0 2 25 12 * /home/users/quy/mydownload

With my script "mydownload". Which command I can put in my script
for automatic downloading ?

In the interactive mode, I have to do :
#ftp ftp.xxxx.com
.... anonymous
.... myaddress..
.... cd ....
.... get file
..... bye for exit

Any ideas for help ?
Thanks in advance.
_______________________________________________________
 Nguyen-Dai Quy
 LTAS - M�canique de la Rupture, ULG.
 Rue Ernest Solvay 21, B�t C3, B 4000, Li�ge, Belgique
 T�l:+32-4-366.92.41	     Fax:+32-4-366.93.11
 http://isis.ltas.ulg.ac.be/dang/who/quy.html
_______________________________________________________



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-16  5:00 Automatic downloading by using cron ? Nguyen-Dai Quy
  1998-12-16  5:00 ` Timothy J. Lee
  1998-12-16  5:00 ` Mario Stargard
@ 1998-12-16  5:00 ` J. S. Jensen
  1998-12-17  5:00 ` Urban Roth
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: J. S. Jensen @ 1998-12-16  5:00 UTC (permalink / raw)


In concerning automated FTP xfers, do you have `lynx?'

Nguyen-Dai Quy wrote:

> Any ideas for help ?

try this:

lynx -source -raw ftp://uame:passwd@address/dir/foo >bar

If it is anonymous, just don't add the uname and passwd, reference the
file through regular URL conventions, then re-direct the output to
whatever file you need.

--
J. S. Jensen
mailto:jsjensen@Paramin.COM
http://www.paramin.com





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-16  5:00 Automatic downloading by using cron ? Nguyen-Dai Quy
  1998-12-16  5:00 ` Timothy J. Lee
@ 1998-12-16  5:00 ` Mario Stargard
  1998-12-16  5:00 ` J. S. Jensen
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Mario Stargard @ 1998-12-16  5:00 UTC (permalink / raw)


	This can be accomplished using a .netrc file and "Here Text".

#!/bin/sh
ftp machine << _HERE_
cd somedirectory
ascii
get somefile
bye
_HERE_

.netrc
machine ray login demo password mypassword

	See the man page for ftp and netrc

	Cheers,
		Mario

Nguyen-Dai Quy wrote:
> 
> Hi,
> Howto download a file via ftp (anonymous) automatically by using
> crontab ?
> I try in my cron file:
> 0 2 25 12 * /home/users/quy/mydownload
> 
> With my script "mydownload". Which command I can put in my script
> for automatic downloading ?
> 
> In the interactive mode, I have to do :
> #ftp ftp.xxxx.com
> .... anonymous
> .... myaddress..
> .... cd ....
> .... get file
> ..... bye for exit
> 
> Any ideas for help ?
> Thanks in advance.
> _______________________________________________________
>  Nguyen-Dai Quy
>  LTAS - M�canique de la Rupture, ULG.
>  Rue Ernest Solvay 21, B�t C3, B 4000, Li�ge, Belgique
>  T�l:+32-4-366.92.41         Fax:+32-4-366.93.11
>  http://isis.ltas.ulg.ac.be/dang/who/quy.html
> _______________________________________________________

--
Mario Stargard
Unix Systems Administrator
(613) 781 1373



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-16  5:00 Automatic downloading by using cron ? Nguyen-Dai Quy
@ 1998-12-16  5:00 ` Timothy J. Lee
  1998-12-17  5:00   ` William Roeder
  1998-12-16  5:00 ` Mario Stargard
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Timothy J. Lee @ 1998-12-16  5:00 UTC (permalink / raw)


Nguyen-Dai Quy <DaiQuy.nguyen@ulg.ac.be> writes:
|Howto download a file via ftp (anonymous) automatically by using
|crontab ?
|I try in my cron file:
|0 2 25 12 * /home/users/quy/mydownload
|
|With my script "mydownload". Which command I can put in my script
|for automatic downloading ?
|
|In the interactive mode, I have to do :
|#ftp ftp.xxxx.com
|.... anonymous
|.... myaddress..
|.... cd ....
|.... get file
|..... bye for exit
|
|Any ideas for help ?

Try using one of the following:

lynx -dump ftp://ftpserver.wherever.com/directory/file > local-file-name

wget ftp://ftpserver.wherever.com/directory/file

Both lynx and wget are free software (http://lynx.browser.org and
ftp://prep.ai.mit.edu/pub/gnu respectively).

If PORT vs. PASV mode is of concern to you (e.g. if you are behind a
firewall that lets one but not the other through), be aware that lynx
defaults to PORT and must have one of the source files changed before
compiling to make it use PASV mode (grep for NO_PORT).  wget defaults
to PORT but has a command line option to use PASV mode.

-- 
------------------------------------------------------------------------
Timothy J. Lee                                                   timlee@
Unsolicited bulk or commercial email is not welcome.             netcom.com
No warranty of any kind is provided with this message.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-16  5:00 Automatic downloading by using cron ? Nguyen-Dai Quy
                   ` (5 preceding siblings ...)
  1998-12-17  5:00 ` Matt Bumgardner
@ 1998-12-17  5:00 ` Giant Wang
  1998-12-17  5:00   ` Mike Di Fulvio
  1998-12-20  5:00 ` MK
  7 siblings, 1 reply; 15+ messages in thread
From: Giant Wang @ 1998-12-17  5:00 UTC (permalink / raw)
  To: Nguyen-Dai Quy

You should get a package "ncftp" and build it into you OS.
If your OS was RedHat or SlackWare, it was builtin package.

    ncftp -a ftp.site:/some/path/and/file

It could connect with anonymous user (with option "-a")
It could get all file in subdirectory (with option "-R")
It could reget file from broken poing (with option "-C")
It could use wildcard file name.
It could .... as you need.

Nguyen-Dai Quy wrote:
> 
> Hi,
> Howto download a file via ftp (anonymous) automatically by using
> crontab ?
> I try in my cron file:
> 0 2 25 12 * /home/users/quy/mydownload
> 
> With my script "mydownload". Which command I can put in my script
> for automatic downloading ?



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-16  5:00 Automatic downloading by using cron ? Nguyen-Dai Quy
                   ` (3 preceding siblings ...)
  1998-12-17  5:00 ` Urban Roth
@ 1998-12-17  5:00 ` Nikola Milutinovic
  1998-12-17  5:00 ` Matt Bumgardner
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Nikola Milutinovic @ 1998-12-17  5:00 UTC (permalink / raw)


Nguyen-Dai Quy wrote:
> 
> Hi,
> Howto download a file via ftp (anonymous) automatically by using
> crontab ?
> I try in my cron file:
> 0 2 25 12 * /home/users/quy/mydownload
> 
> With my script "mydownload". Which command I can put in my script
> for automatic downloading ?

# call as "download <HOST> <Your EMail> <file>
cat > ~/.netrc << EOF
machine $1
user anonymous
pass $2
EOF

ftp $1 << EOT
get $4
bye
EOT

---------------

Nix.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-16  5:00 Automatic downloading by using cron ? Nguyen-Dai Quy
                   ` (2 preceding siblings ...)
  1998-12-16  5:00 ` J. S. Jensen
@ 1998-12-17  5:00 ` Urban Roth
  1998-12-17  5:00 ` Nikola Milutinovic
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Urban Roth @ 1998-12-17  5:00 UTC (permalink / raw)


On Wed, 16 Dec 1998 16:41:58 +0100, Nguyen-Dai Quy
<DaiQuy.nguyen@ulg.ac.be> wrote:

>Hi,
>Howto download a file via ftp (anonymous) automatically by using
>crontab ?
>I try in my cron file:
>0 2 25 12 * /home/users/quy/mydownload
>
>With my script "mydownload". Which command I can put in my script
>for automatic downloading ?
>
>In the interactive mode, I have to do :
>#ftp ftp.xxxx.com
>.... anonymous
>.... myaddress..
>.... cd ....
>.... get file
>..... bye for exit
>

You can start this script with cron. 

#!/bin/ksh
{
 echo "------------- `date` --"
 ftp -i -v -n ftp.xxxx.com  <<!
  user anonymous myaddres
  bin
  get /pub/filename
  bye
!
 echo "-------------- `date` --"
} > /tmp/mydownload.log 2>&1
# EOF

Regards, Urban         



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-17  5:00 ` Giant Wang
@ 1998-12-17  5:00   ` Mike Di Fulvio
  1998-12-17  5:00     ` Jens Kristian S�gaard
  0 siblings, 1 reply; 15+ messages in thread
From: Mike Di Fulvio @ 1998-12-17  5:00 UTC (permalink / raw)


Giant Wang wrote:
> 
> You should get a package "ncftp" and build it into you OS.
> If your OS was RedHat or SlackWare, it was builtin package.

This "ncftp" sounds pretty cool. When I have been tasked to develop cron
based solutions that require interactive programs (like ftp) I have
always used "expect" to build the jobs. If this ncftp is not enough or
you have other interactive programs you want to 'cron' search the web
for expect and install the same.

Good Luck..

> 
>     ncftp -a ftp.site:/some/path/and/file
> 
> It could connect with anonymous user (with option "-a")
> It could get all file in subdirectory (with option "-R")
> It could reget file from broken poing (with option "-C")
> It could use wildcard file name.
> It could .... as you need.
> 
> Nguyen-Dai Quy wrote:
> >
> > Hi,
> > Howto download a file via ftp (anonymous) automatically by using
> > crontab ?
> > I try in my cron file:
> > 0 2 25 12 * /home/users/quy/mydownload
> >
> > With my script "mydownload". Which command I can put in my script
> > for automatic downloading ?

--
Michael P. Di Fulvio                   W3 Solutions Group Inc.
UNIX/Internet Consultants       Project Management - Y2K Analysis
                                       miked@safari.net
--



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-16  5:00 Automatic downloading by using cron ? Nguyen-Dai Quy
                   ` (4 preceding siblings ...)
  1998-12-17  5:00 ` Nikola Milutinovic
@ 1998-12-17  5:00 ` Matt Bumgardner
  1998-12-17  5:00   ` Mike Bristow
  1998-12-17  5:00 ` Giant Wang
  1998-12-20  5:00 ` MK
  7 siblings, 1 reply; 15+ messages in thread
From: Matt Bumgardner @ 1998-12-17  5:00 UTC (permalink / raw)


You could try writing a perl script with the Net::FTP module and then
schedule it with cron.  This is a part of the small script we use at my
work:

use Net::FTP;
&main
sub Main  {
  $ftp = Net::FTP->new ("ftp.server.com");
  $ftp->login("anonymous","anonymous@somewhere.com");
  $ftp->binary();
  $ftp->cwd("/pub");
  $ftp->get("file.zip");
  $ftp->close();
}                     

Good Luck!
-- 
::::::::::::::::::::::::::::::::::::::::::::::::::
Matthew Bumgardner
System Analyst
Shoreland Inc.
mbumgard**@**shoreland.com 
(remove *'s to send email)
::::::::::::::::::::::::::::::::::::::::::::::::::


Nguyen-Dai Quy wrote:
> 
> Hi,
> Howto download a file via ftp (anonymous) automatically by using
> crontab ?
> I try in my cron file:
> 0 2 25 12 * /home/users/quy/mydownload
> 
> With my script "mydownload". Which command I can put in my script
> for automatic downloading ?
> 
> In the interactive mode, I have to do :
> #ftp ftp.xxxx.com
> .... anonymous
> .... myaddress..
> .... cd ....
> .... get file
> ..... bye for exit
> 
> Any ideas for help ?
> Thanks in advance.
> _______________________________________________________
>  Nguyen-Dai Quy
>  LTAS - M�canique de la Rupture, ULG.
>  Rue Ernest Solvay 21, B�t C3, B 4000, Li�ge, Belgique
>  T�l:+32-4-366.92.41         Fax:+32-4-366.93.11
>  http://isis.ltas.ulg.ac.be/dang/who/quy.html
> _______________________________________________________



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-17  5:00   ` Mike Di Fulvio
@ 1998-12-17  5:00     ` Jens Kristian S�gaard
  0 siblings, 0 replies; 15+ messages in thread
From: Jens Kristian S�gaard @ 1998-12-17  5:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 287 bytes --]

Mike Di Fulvio <miked@safari.net> writes:

> This "ncftp" sounds pretty cool. When I have been tasked to develop cron

What's wrong with wget? 

It supports a lot of cool things like globbing, re-getting, etc,
etc. it covers http too.


-- 
Jens Kristian S�gaard,
jks@distributed.dk



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-17  5:00 ` Matt Bumgardner
@ 1998-12-17  5:00   ` Mike Bristow
  0 siblings, 0 replies; 15+ messages in thread
From: Mike Bristow @ 1998-12-17  5:00 UTC (permalink / raw)


Matt Bumgardner <mbumgard@shoreland.com> wrote:
> You could try writing a perl script with the Net::FTP module and then
> schedule it with cron.  This is a part of the small script we use at my
> work:
>
> use Net::FTP;
> &main
> sub Main  {
>   $ftp = Net::FTP->new ("ftp.server.com");
>   $ftp->login("anonymous","anonymous@somewhere.com");
>   $ftp->binary();
>   $ftp->cwd("/pub");
>   $ftp->get("file.zip");
>   $ftp->close();
> }                     
>

Add error checking.  Now.  I mean it.  It's a really good idea.

I'd hope that Net::FTP was written well enough so that you can

$ftp->get('file.zip') or ( mail('sysadmin@shoreland.com', "Oh my god! the get failed! PANIC!") and exit(1) );

but I'm too lazy to rtfm.

-- 
oderint dum metuant



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-16  5:00 ` Timothy J. Lee
@ 1998-12-17  5:00   ` William Roeder
  0 siblings, 0 replies; 15+ messages in thread
From: William Roeder @ 1998-12-17  5:00 UTC (permalink / raw)


"Timothy J. Lee" wrote:
> 
> Nguyen-Dai Quy <DaiQuy.nguyen@ulg.ac.be> writes:
> |Howto download a file via ftp (anonymous) automatically by using
> |crontab ?
> |I try in my cron file:
> |0 2 25 12 * /home/users/quy/mydownload
> |
> |With my script "mydownload". Which command I can put in my script
> |for automatic downloading ?
> |
> |In the interactive mode, I have to do :
> |#ftp ftp.xxxx.com
> |.... anonymous
> |.... myaddress..
> |.... cd ....
> |.... get file
> |..... bye for exit
> |
> |Any ideas for help ?
> 
<snip>
<ns45get>
ftp -nvi <<EOF
open ftp.netscape.com
user anonymous roeder@dba-sys.com
lcd /patches
cd pub/communicator/4.5/english/unix/supported/irix62/complete_install
hash
reget communicator-v45-export.mips-sgi-irix6.2.tar.gz
EOF
</ns45get>
-- 
Bill Roeder
My opinions are my own and do not reflect those of my employer.
Why do people put the above line in their signature? 
If they reflected my employer then he would have sent the message!



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-16  5:00 Automatic downloading by using cron ? Nguyen-Dai Quy
                   ` (6 preceding siblings ...)
  1998-12-17  5:00 ` Giant Wang
@ 1998-12-20  5:00 ` MK
  1998-12-23  5:00   ` qhuo
  7 siblings, 1 reply; 15+ messages in thread
From: MK @ 1998-12-20  5:00 UTC (permalink / raw)


On Wed, 16 Dec 1998 16:41:58 +0100, Nguyen-Dai Quy
<DaiQuy.nguyen@ulg.ac.be> wrote:

>Hi,
>Howto download a file via ftp (anonymous) automatically by using
>crontab ?
>I try in my cron file:
>0 2 25 12 * /home/users/quy/mydownload
>
>With my script "mydownload". Which command I can put in my script
>for automatic downloading ?

man wget
man lftp
man pavuk

and lots of other packages


--------------------------------------------------
Reality is something that does not disappear after 
you ceased believing in it - VALIS, Philip K. Dick
--------------------------------------------------

Delete _removethis_ from address to email me



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-20  5:00 ` MK
@ 1998-12-23  5:00   ` qhuo
  1998-12-29  5:00     ` Bill Thompson
  0 siblings, 1 reply; 15+ messages in thread
From: qhuo @ 1998-12-23  5:00 UTC (permalink / raw)




MK wrote:
> 
> On Wed, 16 Dec 1998 16:41:58 +0100, Nguyen-Dai Quy
> <DaiQuy.nguyen@ulg.ac.be> wrote:
> 
> >Hi,
> >Howto download a file via ftp (anonymous) automatically by using
> >crontab ?
> >I try in my cron file:
> >0 2 25 12 * /home/users/quy/mydownload
> >
> >With my script "mydownload". Which command I can put in my script
> >for automatic downloading ?
> 
> man wget
> man lftp
> man pavuk
> 
> and lots of other packages
> 

ftp can be used to do it.

First create a file ~/.netrc contains a line like this:
default anonymous guest@

Then create a command file ftp_commands like this:
open ftp_site_address
cd /dir/to/the/file
lcd /local/dir/to/put/the/file
bin (or asc)
get name_of_the_file
bye

Now, issue the command:
ftp < ftp_commands

To do it via crontab, just put last command in "mydownload".



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Automatic downloading by using cron ?
  1998-12-23  5:00   ` qhuo
@ 1998-12-29  5:00     ` Bill Thompson
  0 siblings, 0 replies; 15+ messages in thread
From: Bill Thompson @ 1998-12-29  5:00 UTC (permalink / raw)



qhuo wrote in message <36805353.CD334257@990.net>...
>
>
>MK wrote:
>>
>> On Wed, 16 Dec 1998 16:41:58 +0100, Nguyen-Dai Quy
>> <DaiQuy.nguyen@ulg.ac.be> wrote:
>>
>> >Hi,
>> >Howto download a file via ftp (anonymous) automatically by using
>> >crontab ?
>> >I try in my cron file:
>> >0 2 25 12 * /home/users/quy/mydownload
>> >
>> >With my script "mydownload". Which command I can put in my script
>> >for automatic downloading ?
>>
>> man wget
>> man lftp
>> man pavuk
>>
>> and lots of other packages
>>
>
>ftp can be used to do it.
>
>First create a file ~/.netrc contains a line like this:
>default anonymous guest@
>
>Then create a command file ftp_commands like this:
>open ftp_site_address
>cd /dir/to/the/file
>lcd /local/dir/to/put/the/file
>bin (or asc)
>get name_of_the_file
>bye
>
>Now, issue the command:
>ftp < ftp_commands
>
>To do it via crontab, just put last command in "mydownload".

That will work, but it can be done without a ~/.netrc file:

Create a command file: ftp_commands:

open ftp_site_address
user user_name password
cd /dir/to/the/file
lcd /local/dir/to/put/the/file
bin (or asc)
get name_of_the_file (or mget wildcard_specification)
bye

Now issue the command:
ftp -n <ftp_commands





^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~1998-12-29  5:00 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-12-16  5:00 Automatic downloading by using cron ? Nguyen-Dai Quy
1998-12-16  5:00 ` Timothy J. Lee
1998-12-17  5:00   ` William Roeder
1998-12-16  5:00 ` Mario Stargard
1998-12-16  5:00 ` J. S. Jensen
1998-12-17  5:00 ` Urban Roth
1998-12-17  5:00 ` Nikola Milutinovic
1998-12-17  5:00 ` Matt Bumgardner
1998-12-17  5:00   ` Mike Bristow
1998-12-17  5:00 ` Giant Wang
1998-12-17  5:00   ` Mike Di Fulvio
1998-12-17  5:00     ` Jens Kristian S�gaard
1998-12-20  5:00 ` MK
1998-12-23  5:00   ` qhuo
1998-12-29  5:00     ` Bill Thompson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox