How do you schedule tasks to run in SilverStripe, for example run a task every hour? Or even access a rest api every minute.
Asked
Active
Viewed 389 times
1 Answers
1
There are two possibilities: Cron or... faked cron.
If you can use cron on your server directly call SilverStripe in your CLI.
//run a task "MyTask" every hour at minute 29:
//min hr day month dayofweek
29 * * * * /your/site/folder/sake dev/tasks/MyTask
//run a task "MyTask" at 3:13 am every sunday:
29 3 * * 0 /your/site/folder/sake dev/tasks/MyTask
If you do not have access to cron for some reason, there is this SilverStripe crontask module you can use.