?
Solved

Cron WGET with php ...

Posted on 2004-08-30
14
Medium Priority
?
1,069 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 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