Reputation: 199
I am calling wget from crontab to periodically call a php script on my site:
wget -q http://mydomain.com/myscript?pa=doscript >/dev/null 2>&1
It works fine, but in the root dir of my webspace each call creates output files called
myscript?pa=doscript
myscript?pa=doscript.1 ...
I tried to supress the output with -q and >/dev/null 2>&1 but obviously it does not work. Why?
Upvotes: 1
Views: 462
Reputation: 69947
Try:
wget -O /dev/null -q http://mydomain.com/myscript?pa=doscript >/dev/null 2>&1
This tells wget
to save the file to /dev/null
essentially discarding it.
See man wget
and the -O
option.
Upvotes: 2
Reputation: 59699
Just call PHP from the cron job instead of wget:
php -f /path/to/myscript pa=doscript
Or:
/usr/bin/php -f /path/to/myscript pa=doscript
This assumes the small trick to import $_GET
variables from the command line:
parse_str(implode('&', array_slice($argv, 1)), $_GET);
Or, you can rewrite your script to use $argc
and $argv
.
Upvotes: 1