Solved

Cron WGET with php ...

Posted on 2004-08-30
14
1,052 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
 

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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now