Using WGET to run a cronjob PHP
You could tell wget to not download the contents in a couple of different ways:
wget --spider http://www.example.com/cronit.php
which will just perform a HEAD request but probably do what you want
wget -O /dev/null http://www.example.com/cronit.php
which will save the output to /dev/null (a black hole)
You might want to look at wget's -q switch too which prevents it from creating output
I think that the best option would probably be:
wget -q --spider http://www.example.com/cronit.php
that's unless you have some special logic checking the HTTP method used to request the page
Using wget in a crontab to run a PHP script
wget's output to STDOUT is it trying to make a connection, showing progress, etc.
If you don't want it to store the saved file, use the -O file
parameter:
/usr/bin/wget -q --post-data -O /dev/null 'pass=mypassword' http://www.mywebsite.com/myscript.php > /dev/null 2>&1
Checkout the wget manpage. You'll also find the -q
option for completely disabling output to STDOUT (but offcourse, redirecting the output as you do works too).
How to setup a wget cron job command
Use curl like this:
/usr/bin/curl http://domain.com/page.php
Don't worry about the output, it will be ignored
Can I use wget to run a local file as a cron job using relative path above public_html?
The best command is php /home/account/invest/controllers/cron_controller.php
.
Cronjob wget only posting the first variable
Just put the entire url in double quotes, or single ones, as may work here.
Cron job with CodeIgniter using wget
You can force a particular shell with
SHELL=bash
*/5 * etc...
or whatever in the crontab. Then make sure wget is available in that shell's path.
Otherwise just give an absolute /usr/bin/wget path instead.
*/5 * * * * /usr/bin/wget etc...
Related Topics
Ruby and PHP Hmacs Not Agreeing
Get Root Node of Xml Doc Using Simplexml
Using Regex to Filter Attributes in Xpath with PHP
Errorbag Is Always Empty in Laravel 5.2
Pdo Try-Catch Usage in Functions
Composer Update Failed -- Out of Memory
How to Alias a Function in PHP
How to Alias the Name of a Column in Eloquent
Php: Split String into Array, Like Explode with No Delimiter
Htmlspecialchars VS HTMLentities When Concerned with Xss
Is Multiple Inheritance Allowed at Class Level in PHP
Backslash in PHP -- What Does It Mean