Merge pull request #1760 from jedateach/patch-3

CommandLine: Info about running regular tasks with cron
This commit is contained in:
Sam Minnée 2013-05-24 23:53:45 -07:00
commit 99275ea783

View File

@ -124,3 +124,25 @@ Step 3: Use sake to start and stop your process
Note that sake processes are currently a little brittle, in that the pid and log files are placed in the site root
directory, rather than somewhere sensible like /var/log or /var/run.
### Running Regular Tasks With Cron
On a unix machine, you can typically run a scheduled task with a [cron job](http://en.wikipedia.org/wiki/Cron),
using one of the following command-line calls:
```
/path/to/site_root/framework/sake MyTask
php /path/to/site_root/framework/cli-script.php MyTask
```
If you find that your cron job appears to be retrieving the login screen, then you may need to use `php-cli`
instead. This is typical of a cPanel-based setup.
```
php-cli /path/to/site_root/framework/cli-script.php MyTask
```
A good approach to setting up and testing your task to run with cron is:
1. Try running the task via the command-line on your server. `/path/to/site_root/framework/sake MyTask`
2. Set up a cron job to run the task every minute. `* * * * * /path/to/site_root/framework/sake MyTask`
3. Finally, set the task to run when you want it to. `0 2 * * * /path/to/site_root/framework/sake MyTask` (2am)