You could hard-wire the Cake path into the environment. With multiple cake core versions on a single system, sometimes it is better not to do that, though. So I just follow the following guidelines:
- Only add the PHP path to the system environment path (not the cake one!)
- Always navigate to your app folder.
- Call your shells from there, either with
Console/cake(if you have an app Console folder with cake file) or
../lib/Cake/Console/cake(core cake file).
The documentation in the cookbook is pretty well written.
Here with a little bit more detailed explanation:
# m h dom mon dow command */5 * * * * cd /full/path/to/app && Console/cake myshell myparam
The tool Crontab is used here. This config file contains an example with a cronjob that is executed every 5 minutes. Basically, you just tell the script to navigate into your app folder and call your shell as you normally would as real user (always from inside your app folder).
You can edit the crontab for the www-data user, for example, using
crontab -e -u www-data
CakePHP 2.x and windows
See the updated windows post for the correct path here. Also note the way more comfortable quick-links if you need to use 1.x and 2.x parallel.