Reputation: 554
Im running ubuntu server, and im trying to run a script every hour. What I tried is:
sudo crontab -e
and then I add this to the end of the file:
MAILTO="[email protected]"
30 * * * * /usr/bin/php /var/www/scripts/cronscript.php
The script doesnt seem to be running, and im not getting the email.
What am I doing wrong?
Upvotes: 0
Views: 326
Reputation: 4283
You can also use cURL, like this:
curl http://foobar.com/scripts/cronscript.php
If you need it to run silently:
curl --silent http://foobar.com/scripts/cronscript.php
To add Gzip handling:
curl --compressed http://foobar.com/scripts/cronscript.php
I usually use both, like: curl --silent --compressed http://foobar.com/scripts/cronscript.php
Upvotes: 1
Reputation: 554
using:
30 * * * * /usr/bin/wget "http://example.com/scripts/cronscript.php"
worked for me
Upvotes: 2
Reputation: 18290
Use the -f
flag of php to tell it to take that file as input:
MAILTO="[email protected]"
30 * * * * /usr/bin/php -f /var/www/scripts/cronscript.php
That is, of course, if your php is actually located at /usr/bin
Upvotes: 3