Answers.Body: <p>Craft's tasks are meant for long-running PHP requests and don't have to execute immediately.  By default when you create a new task, it is queued in the database in the <code>craft_tasks</code> table and it takes a control panel request to trigger it to run, so with that method, there's no guaranteed way to have it run every 15 minutes.</p>
  
  <p>However, if you set the <a href="https://craftcms.com/docs/config-settings#runTasksAutomatically" rel="nofollow">runTasksAutomatically</a> config setting to false, then you can setup an cron job that runs at any interval you wish.  You'd point it to a controller action on your plugin and manually trigger the task that way.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-14T23:25:49.340Z
Answers.Text: So there's no repeat-scheduling available in Craft then? All scheduling has to be done in Cron?
Answers.UserDisplayName: Simon East
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-14T23:31:05.990Z
Answers.Text: @SimonEast Correct.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-12-22T18:23:14.270Z
Answers.LastActivityDate: 2015-12-22T18:23:14.270Z
Answers.UserDisplayName: Brad Bell
Body: <p>I am trying to get my head around the TaskService that Craft comes with. I want to create a task that periodically (say every 15 minutes) uses the Twitter API. I am currently creating a task modeled on Pixel &amp; Tonic's <a href="https://github.com/pixelandtonic/PowerNap" rel="nofollow">PowerNap</a> which was very helpful, but I still don't understand how the tasks are triggered.</p>
  
  <p>In the createTask method I didn't see any duration or anything like that and if the tasks are created within a controller that would have to be posted to, would this require a tandom cron job to trigger it from the server?</p>
  
  <p>Any clarifications, insights, or references that might be helpful in better understanding the TaskService would be greatly appreciated as the Class Reference's docs aren't really that helpful.</p>
  
  <p>Thanks!</p>
  
Tags: <cron>
Title: Craft TaskService Overview/Cron Job
ThreadText: # Craft TaskService Overview/Cron Job
  
  (Asked by: username_0 on 2015-12-22)
  
  I am trying to get my head around the TaskService that Craft comes with. I want to create a task that periodically (say every 15 minutes) uses the Twitter API. I am currently creating a task modeled on Pixel & Tonic's [PowerNap](https://github.com/pixelandtonic/PowerNap) which was very helpful, but I still don't understand how the tasks are triggered.
  
  In the createTask method I didn't see any duration or anything like that and if the tasks are created within a controller that would have to be posted to, would this require a tandom cron job to trigger it from the server?
  
  Any clarifications, insights, or references that might be helpful in better understanding the TaskService would be greatly appreciated as the Class Reference's docs aren't really that helpful.
  
  Thanks!
  
  **Tags:** cron
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-12-22. Score: 3 | Accepted answer
  
  Craft's tasks are meant for long-running PHP requests and don't have to execute immediately. By default when you create a new task, it is queued in the database in the `craft_tasks` table and it takes a control panel request to trigger it to run, so with that method, there's no guaranteed way to have it run every 15 minutes.
  
  However, if you set the [runTasksAutomatically](https://craftcms.com/docs/config-settings#runTasksAutomatically) config setting to false, then you can setup an cron job that runs at any interval you wish. You'd point it to a controller action on your plugin and manually trigger the task that way.
  
  > **Comments:**
  > **username_2**: So there's no repeat-scheduling available in Craft then? All scheduling has to be done in Cron?  
  > **username_1**: @username_2 Correct.  
  
  ---
  
  