jmueller0823
asked on
Cron WGET with php ...
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.
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.
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?
ASKER
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).
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).
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
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
ASKER
Exactly.
But how do I determine what the correct fullpath is for wget?
Pls see my comments (above) in the pervious post.
But how do I determine what the correct fullpath is for wget?
Pls see my comments (above) in the pervious post.
which wget
or
find / -type f -name wget -print
should give you the full path.
or
find / -type f -name wget -print
should give you the full path.
ASKER
Got it. Thank you.
ASKER
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.
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.
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.
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
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
ASKER
So, something like this?
10 * * * * wget -P /usr/local/bin -N -q http://www.sitename.com/phads/maintenance/maintenance.php
10 * * * * wget -P /usr/local/bin -N -q http://www.sitename.com/phads/maintenance/maintenance.php
Yep.
ASKER
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.