How do I call a web page in the Unix cron?

I have a web page that performs some sql statements against a database. All I have to do to perform the operations is go to http://mydomain.com/sqlop.php?param1=123¶m2=xyz. There's no user intervention needed, the page just does it. How do I call this web page from the cron so it calls it on a scheduled basis?
bemara57Asked:
Who is Participating?
 
robocatConnect With a Mentor Commented:
The GNU wget utility will do this

http://www.gnu.org/software/wget/

Install and then put this command like this  in your cron

wget -O /tmp/out.txt  "http://mydomain.com/sqlop.php?param1=123¶m2=xyz"

0
 
overflow34Connect With a Mentor Commented:
http://forum.powweb.com/archive/index.php/t-13524.html

Try this link.  I think this is what you are looking for.
0
 
gheistCommented:
Why don't you schedule SQL statements from cron script? Fetching webpage introduces more moving parts in machine.
0
 
omarfaridConnect With a Mentor Commented:
Hi,

You may use wget as a crontab job to check your web page. You may have a script like the following, call it checkmypage

cd /path/to/mydir
/path/to/wget www.mydomain.com
if test $? -eq 0
then
.
.
.
else
.
.
.
fi

The above script checks for the exit status of wget ($?)
I left the two sections with dots so that you put your own commands when successful or failure.

The script can be made executable and run as ccrontab job:

crontab -l > mycrontab

add the line below to mycrontab

0,10,20,30,40,50  * * * * /path/to/checkmypage

resubmit your cronjobs

crontab mycrontab

0
 
estrelowConnect With a Mentor Commented:
An alternative to wget is using lwp-request.
Just set:

lwp-request http://mydomain.com/sqlop.php?param1=123¶m2=xyz
0
All Courses

From novice to tech pro — start learning today.