Crontab Wget, downloading a file to a FTP


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Crontab Wget, downloading a file to a FTP
# 1  
Old 11-03-2010
Crontab Wget, downloading a file to a FTP

Hi there,

I've got my own domain, ftp etc.. I'm using cPanel and I want to download a file periodically, every say 24 hours.

I've used this command:

Code:
wget -t inf http : / / www . somesite . com / webcam.jpg
ftp : / / i @ MyDomain . net : Password @ ftp . MyDomain . net

^no spaces offcourse... otherwise I wouldn't be able to type urls here on forum...

I was told to use /home/UserName/public_html/ instead of ftp login details, but it doesn't work so I've used ftp login details.

Now, yes, the jpg file is being downloaded to my ftp, but in root folder, not even in /public_html/ folder. I've tried with my main ftp login, which is without the "@" symbol.. I tried adding /public_html/ to an end and still, files are being downloaded to the root folder on my ftp Smilie

What am I doing wrong?

I would appreciate help as I am brand spanking new to this Smilie

Last edited by zYx; 11-03-2010 at 08:46 AM..
# 2  
Old 11-03-2010
Well, even not knowing cPanel or these commands, the spacey URL on the second line lacks a path after the host, s it defaults to the root (unless the user is forced to one subdir as if chroot).
# 3  
Old 11-03-2010
I don't think they meant login to /home/user/public_html/, I think they meant login using user's credentials and upload into public_html.

Can you repost, in code tags? It's so mangled I can't tell what you're even trying to do. I think you've got a wget in there, but I don't know what that raw FTP url's supposed to do in cpanel or crontab, it's just a URL. Put your stuff in code tags and it won't get mangled, like this. Quote my post to see how. It's easy.

Code:
http://www.url.com/

# 4  
Old 11-03-2010
In other words, the second line resembles an ftp URL:
Code:
ftp://USER:PASSWORD@host.domain.higher_domain/top_level_dir/next_level_dir/

but has no pathing /top_level_dir/next_level_dir/ inside the host.
# 5  
Old 11-03-2010
I tried to put it in code and because I had less than 5 posts I wasn't able to use URLs here on forums, so I'm gonna try now:

Code:
get -t inf http://www.somesite.com/webcam.jpg ftp://UserName@MyDomain.net:Password@ftp.MyDomain.net

Ok it works now, so it should be clearer for you.

i also tried this:

Code:
get -t inf http://www.somesite.com/webcam.jpg ftp://UserName@MyDomain.net:Password@ftp.MyDomain.net/public_html/yyy/

but it would still be saved to the root.

Just so you know that I am not really a unix person, I've always worked with windows, and currently have win7, but it hasn't got anything to do with windows since the CronTab I'm trying to use is in my cPanel on my hosting account. I believe this is unix technology and this is where the problem starts ;]

Another thing, all these JPG files have the same name, so every time a new JPG is being downloaded, numbers are added to the end of the file name. I.e. IMAGE.JPG.1, IMAGE.JPG.2 etc... Is there any chance to change the name to IMAGE.1.JPG or something like that?
Also, with every single JPG file, a HTML files are being downloaded or.. created. Index.html.1, Index.html.2 etc.. which contains the following:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
 <HEAD>
  <TITLE>Index of /yyy/y</TITLE>
 </HEAD>
 <BODY>
<H1>Index of /yyy/y</H1>
<PRE><IMG SRC="/icons/blank.gif" ALT="     "> <A HREF="?N=D">Name</A>                    <A HREF="?M=A">Last modified</A>       <A HREF="?S=A">Size</A>  <A HREF="?D=A">Description</A>
<HR>
<IMG SRC="/icons/back.gif" ALT="[DIR]"> <A HREF="/yyy/">Parent Directory</A>        03-Nov-2010 11:22      -  
</PRE><HR>
<ADDRESS>Apache/1.3.37 Server at MyServer.net Port 80</ADDRESS>
</BODY></HTML>

The /yyy/y/ are just a testing folders in /home/user/public_html/yyy/y/.

Don't know what the "/icons/back.gif" isSmilie

I also get emails every time cron runs:

Code:
--01:29:01--  http://somesite.com/webcam32.jpg
           => `webcam32.jpg.24'
Resolving www.somesite.com... 195.173.130.149 Connecting to www.somesite.com|195.173.130.149|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21,470 (21K) [image/jpeg]

    0K .......... ..........                                 100%  165.31 KB/s

01:29:02 (165.31 KB/s) - `webcam32.jpg.24' saved [21470/21470]

--01:29:02--  ftp://user:*password*@ftp.MyServer.net/public_html/yyy/
           => `.listing'
Resolving ftp.MyServer.net... 193.218.153.71 Connecting to ftp.MyServer.net|xxx.xxx.xxx.71|:21... connected.
Logging in as User ... Logged in!
==> SYST ... done.    ==> PWD ... done.
==> TYPE I ... done.  ==> CWD /public_html/yyy ... done.
==> PASV ... done.    ==> LIST ... done.

    0K                                                         589.90 KB/s

01:29:02 (589.90 KB/s) - `.listing' saved [119]

Removed `.listing'.
Wrote HTML-ized index to `index.html.6' [236].

FINISHED --01:29:02--
Downloaded: 21,470 bytes in 1 files

Though, the file is still saved in the root, not in public_html/yyy.

When i used /home/user/public_html/ instead of ftp login details, the email came saying:

Code:
/home/user/public_html/: Unsupported Scheme

along with the rest of the emails, similar to the one above... whatever that means.

Tried googling it, but couldn't find anything related to my particular "issue" :]

Last edited by zYx; 11-03-2010 at 04:13 PM..
# 6  
Old 11-03-2010
The message "/home/user/public_html/: Unsupported Scheme" says paths are $HOME relative. Do you have directories: /home/user/public_html/ and /home/user/public_html/folder/ ?
# 7  
Old 11-03-2010
This is what I see when I log in to my ftp :P

Image

The "/home/user/public_html/folder/" is just an example name, in fact it's called /yyy/ ;P and yes, it is there, in /home/user/public_html/yyy/

Image
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Wget for downloading a public file (stream) as mp4

I need a hint for using wget for getting a free content from a TV station that is streaming its material for a while until it appears on any video platform, that means no use of illegal methods, because it is on air, recently published and available. But reading the manual for wget I tried the... (5 Replies)
Discussion started by: 1in10
5 Replies

2. Shell Programming and Scripting

Wget error while downloading from https website

Hi, I would like to download a file from a https website. I don't have the file name as it changes every day. I am using the following command: wget --no-check-certificate -r -np --user=ABC --password=DEF -O temp.txt https://<website/directory> I am getting followin error in my... (9 Replies)
Discussion started by: pinnacle
9 Replies

3. Shell Programming and Scripting

Downloading FTP Files

Hi every one, I have the requirement to download the files from FTP and move those files to unix box. Once after coping the files, i need to remove the files in FTP. I'm a newbie in Unix script. Can you please suggest a script for this.. Thanks in advance.. (2 Replies)
Discussion started by: Murali4u
2 Replies

4. Shell Programming and Scripting

Downloading with Wget

Hello everyone. I'm new both to the forum and to unix scripting, and this website has been very useful in putting together a script I am working on. However, I have run into a bit of a snag, which is why I have come here seeking help. First I will say what I am trying to do, and then what I have... (2 Replies)
Discussion started by: keltonhalbert
2 Replies

5. UNIX for Dummies Questions & Answers

wget pdf downloading problem

Hi. I am trying to make a mirror of this free online journal: http://www.informaworld.com/smpp/title~content=t716100758~db=all Under the individual issues, the link location for the "Full Text PDF" does not have ".pdf" as an extension -- so when I use wget it misses the file. However clicking... (5 Replies)
Discussion started by: obo1234
5 Replies

6. Solaris

HTTP error while downloading solaris patches using wget

Hello, I am getting a HTTP error while downloading solaris patches using wget. 'Downloading unsigned patch 113096-03. --2010-06-18 03:51:15-- http://sunsolve.sun.com/pdownload.pl?target=113096-03&method=h Resolving sunsolve.sun.com (sunsolve.sun.com)... 192.18.108.40 Connecting to... (5 Replies)
Discussion started by: sunny_a_j
5 Replies

7. Shell Programming and Scripting

Problem in Downloading one day old files from FTP site

HI, I'm downloading one day old files from ftp site. Below is my script ---------------------------- printf "open $HOST \n" > ftp.cmd printf "user $USER $PASSWD\n" >> ftp.cmd printf "bin\n" >> ftp.cmd #printf "cd /Models/\n" >> ftp.cmd printf "prompt\n" >> ftp.cmd printf "for oldfile... (4 Replies)
Discussion started by: shekhar_v4
4 Replies

8. UNIX for Advanced & Expert Users

downloading through ftp

i have been busy getting accustomed to ssh and ftp and have a remote account that I am trying to comprehend.. my question is when I use ftp, ssh and remote accounts where do I download packages to.. which directory.. i have a cooledit package that is tarred and gziped which I ncftpd from... (6 Replies)
Discussion started by: moxxx68
6 Replies

9. UNIX for Dummies Questions & Answers

Downloading whole directory with FTP

Is it possible using FTP to download a whole directory and all subdirectories at once without having to go through every single file? Thanks, Tom (4 Replies)
Discussion started by: Pokeyzx
4 Replies

10. UNIX for Dummies Questions & Answers

downloading folders in ftp

can you download folders when in ftp or is the only way to download more then one file by mget?? (6 Replies)
Discussion started by: eloquent99
6 Replies
Login or Register to Ask a Question