Answers.Body: <p>Sounds like a pretty simple custom Craft <a href="http://buildwithcraft.com/docs/plugins/introduction" rel="nofollow">plugin</a>.</p>
  
  <p>You'd add a <a href="http://buildwithcraft.com/docs/plugins/controllers" rel="nofollow">controller</a> to your plugin and an action method and allow <a href="http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions" rel="nofollow">anonymous access</a> to it.</p>
  
  <p>Your method would run any queries you need and save the results to an XML file on the server somewhere.</p>
  
  <p>Then setup cron to execution the action at whatever interval you want.</p>
  
  <pre><code>0 3 * * * curl -s -o /dev/null "http://mydomain.com/actions/myplugin/myaction"
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-05T17:27:25.220Z
Answers.LastActivityDate: 2015-10-05T17:27:25.220Z
Answers.UserDisplayName: Brad Bell
Body: <p>For an upcoming project one of the requests is that the client needs to be able to run a few custom queries on a specific section (queries are fixed, we know what these will be in advance) and then save the output to an xml file on the server. Bonus points if we can do this with a cron job, say daily.</p>
  
  <p>I've been looking at several plugins (Sprout reports, Zenbu) but none really do what I need out of the box.</p>
  
  <p>How would I go about handling this? Sorry if this question is too general, just looking for pointers on where to start. Any input appreciated!</p>
  
Tags: <plugin-development><cron><xml>
Title: Running custom query save result to xml file
ThreadText: # Running custom query save result to xml file
  
  (Asked by: username_0 on 2015-10-05)
  
  For an upcoming project one of the requests is that the client needs to be able to run a few custom queries on a specific section (queries are fixed, we know what these will be in advance) and then save the output to an xml file on the server. Bonus points if we can do this with a cron job, say daily.
  
  I've been looking at several plugins (Sprout reports, Zenbu) but none really do what I need out of the box.
  
  How would I go about handling this? Sorry if this question is too general, just looking for pointers on where to start. Any input appreciated!
  
  **Tags:** plugin-development, cron, xml
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-10-05. Score: 1 | Accepted answer
  
  Sounds like a pretty simple custom Craft [plugin](http://buildwithcraft.com/docs/plugins/introduction).
  
  You'd add a [controller](http://buildwithcraft.com/docs/plugins/controllers) to your plugin and an action method and allow [anonymous access](http://buildwithcraft.com/docs/plugins/controllers#allowing-anonymous-access-to-actions) to it.
  
  Your method would run any queries you need and save the results to an XML file on the server somewhere.
  
  Then setup cron to execution the action at whatever interval you want.
  
  ```
  0 3 * * * curl -s -o /dev/null "http://mydomain.com/actions/myplugin/myaction"
  
  ```
  
  
  ---
  
  