Solved

Cron WGET with php ...

Posted on 2004-08-30
14
1,064 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

737 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