Hello
I have a server with ubuntu I want to run a cron job which runs the method "index" of the controller "updater" one time per minute or one time per day, not sure yet.
I have VERY basic knowledge in linux, and I don't know what to do. I have read that with kohana is very easy to do a cronjob, but I don't understand how.
VERY IMPORTANT: I don't even know how to find where php is in my server... and if I do php in the console I get The program 'php5' is currently not installed.
Can someone explain to me how to do a cronjob as I was a 5 years old child? Thank you very much :)
By the way, I use Kohana 3.0
i would do it like this:
type crontab -e
append a line like this:
56 * * * * /usr/bin/wget -O - -q -t 1 http://yourdomain.com/updater/ >/dev/null 2>&1
and save the file. Thats once an hour@56 minutes btw.
omg That's so perfect thank you very much :)
That command is chinese for me, but it works like a charm :)
Don't do that. You can call it with index.php on the command line.
php index.php --uri=<whatever-it-is>
Don't use curl or wget on the command line.
better dont use external url can be acccessed from web
VERY IMPORTANT: I don't even know how to find where php is in my server
whereis php say path to php
Well, it's not important if it's possible to access this from the web... so I will use the external url anyway :)
Medar... I did that command and this is the response:
php:
Thank you guys, you are the best :)
I followed instructions I found here (and on several other places) to use the following code for a cronjob:
php index.php --uri=my_controller/my_method
but it always brings me to the default controller of my website (the default route). I don't understand why. When I call the my_controller/my_method from a browser, it works fine.
I also tried php index.php --uri="my_controller/my_method"
with the same problematic result.
I hope somebody on this forum can shed some light on it.
problem solved!
I unintentionally started php as cgi instead of cli (/usr/bin/php versus /usr/local/bin/php) I found the answer here: http://dev.kohanaframework.org/issues/3638
It looks like you're new here. If you want to get involved, click one of these buttons!