linux – Using WGET to run a cronjob PHP

linux – Using WGET to run a cronjob PHP

You could tell wget to not download the contents in a couple of different ways:

n

wget --spider http://www.example.com/cronit.phpn

n

which will just perform a HEAD request but probably do what you want

n

wget -O /dev/null http://www.example.com/cronit.phpn

n

which will save the output to /dev/null (a black hole)

n

You might want to look at wgets -q switch too which prevents it from creating output

n

I think that the best option would probably be:

n

wget -q --spider http://www.example.com/cronit.phpn

n

thats unless you have some special logic checking the HTTP method used to request the page

b’

wget -O- http://www.example.com/cronit.php >> /dev/nulln

n

This means send the file to stdout, and send stdout to /dev/null

linux – Using WGET to run a cronjob PHP

I tried following format, working fine

n

*/5 * * * * wget --quiet -O /dev/null http://localhost/cron.phpn

Leave a Reply

Your email address will not be published.