Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Cron WGET with php ...

Posted on 2004-08-30
14
Medium Priority
?
1,075 Views
Last Modified: 2008-02-01
Each of these cron jobs worked fine weeks ago; now they don't run. Not sure what changed.
If you would, please review below.

`````````````````````````````````````````````
EXAMPLE #1
6 22 * * 0  wget -N -q -P public_html http://www.site.com/popular/popular_short.php

The above line is supposed to make a copy of popular_short.php in the root folder.

EXAMPLE #2
10 22 * * 0 wget -N -q http://www.site/popular/popular_reset.php

The above line is supposed to simply execute popular_reset.php

`````````````````````````````````````````````
NOTE >> Both of the above command lines run successfully when run manually. They will not run via cron.

Help please. Thanks.
0
Comment
Question by:jmueller0823
  • 6
  • 3
  • 3
  • +1
14 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 11936306
When a cron job executes any errors will be reported in an email to user that owns the cron job. What errors are being reported?
0
 

Author Comment

by:jmueller0823
ID: 11938488
Ah ha...

Email Error: "wget: not found"

So, sounds like I need a wget path in the command line? (I wonder why it worked before.)

I do have shell access, but have no idea where wget is located (I don't seem to have visability in my FTP client below the root).

0
 
LVL 38

Expert Comment

by:yuzh
ID: 11938586
Type in:

which wget, and use fullpath for the crontab.

eg:

6 22 * * 0  /path-to/wget -N -q -P public_html http://www.site.com/popular/popular_short.php
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jmueller0823
ID: 11941893
Exactly.

But how do I determine what the correct fullpath is for wget?
Pls see my comments (above) in the pervious post.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 11942022
which wget
or
find / -type f -name wget -print
should give you the full path.
0
 

Author Comment

by:jmueller0823
ID: 11942274
Got it. Thank you.
0
 

Author Comment

by:jmueller0823
ID: 11948471
QUESTION

Looks like I don't have the correct syntax.

10 * * * * /usr/local/bin/wget -N -q -P http://www.sitename.com/phads/maintenance/maintenance.php

(I verified the path per instructions above.)

The error we're receiving (via email) is  "wget: missing URL"

The same error appears when entering the command manually.

Ideas?  Thanks again.


0
 
LVL 40

Expert Comment

by:jlevie
ID: 11948929
You are missing the argument to the -P option. That would be the directory prefix where all other files/subdirs will be saved to, i.e., the top of the directory tree.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 11949278
Just in case you need more help for wget command line syntax, have a
look at the following examples:

http://linux.math.tifr.res.in/manuals/html/wget/wget_7.html#SEC31

Full doc:
http://linux.math.tifr.res.in/manuals/html/wget/wget_toc.html#SEC_Contents
0
 

Author Comment

by:jmueller0823
ID: 11952534
So, something like this?

10 * * * * wget -P /usr/local/bin -N -q http://www.sitename.com/phads/maintenance/maintenance.php
0
 
LVL 40

Expert Comment

by:jlevie
ID: 11954548
Yep.
0
 

Author Comment

by:jmueller0823
ID: 11954634
Ok. I believe the problem is solved.

My fault-- sorry for the confusion.

This particular usage of wget was JUST to execute the file-- NOT to copy page(s).
Therefore, the -P option needed to be removed.

The above command is INCORRECT.
The CORRECT command is:

10 * * * * /usr/local/bin wget  -N -q http://www.sitename.com/phads/maintenance/maintenance.php


0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12195330
PAQed, with points refunded (250)

Computer101
E-E Admin
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question