Answers.Body: <p>As noted there are various ways documented for <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs#ManagingScheduledJobs-Command-lineSyntaxforRunningJobs" rel="nofollow">scheduling jobs</a>. At our organisation we wanted an easy way to allow our users to set up scheduled email reports and came up with a shared Google Sheet which lets people enter a report instance Id and reporting frequency. </p>
  
  <p>The Sheet uses Google Apps Script to trigger the report generation via the URL method. The template and code has been written up here <a href="https://mashe.hawksey.info/2015/06/custom-regular-reporting-from-civicrm-with-google-sheets-and-google-apps-script/" rel="nofollow">https://mashe.hawksey.info/2015/06/custom-regular-reporting-from-civicrm-with-google-sheets-and-google-apps-script/</a> (Disclosure: I'm the author)</p>
  
  <p>[We also extended the solution to extract csv attachments and import into separate Google Sheets]</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-23T14:29:17.960Z
Answers.LastActivityDate: 2015-06-23T14:29:17.960Z
Answers.UserDisplayName: mhawksey
Answers.Body: <p>You can set up cron jobs besides the main one driving all the scheduled jobs on the Scheduled Jobs page.  The way to do it is explained at <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs#ManagingScheduledJobs-PHPclimethod">http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs#ManagingScheduledJobs-PHPclimethod</a></p>
  
  <p>You might have your main job going every 10 minutes like:</p>
  
  <pre><code>*/10 * * * * php /path/to/civicrm/bin/cli.php -s site -u user -p password -e Job -a execute
  </code></pre>
  
  <p>You'll just need to add a new one for the report, let's say to send the report instance with the ID of 123 every Monday at 8:00:</p>
  
  <pre><code>0 8 * * 1 php /path/to/civicrm/bin/cli.php -s site -u user -p password -e Job -a mail_report --instanceId=123
  </code></pre>
  
  <p>You don't need anything in the main Scheduled Jobs page for this--this is 100% separate.</p>
  
  <p>Back in the old days, this is how you had to do all scheduled jobs!  Uphill--both ways!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-14T12:25:59.320Z
Answers.Text: can you extend your answer to include a second parameter - for mail_report, that would be 'format' ? Is that `...-e Job -a mail_report --instanceId=123&format=csv` ?
Answers.UserDisplayName: commonpike
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-15T14:43:21.043Z
Answers.Text: I don't have time to test it right now, but I'm pretty sure you want to do 
  `... --instanceId=123 --format=csv`
Answers.UserDisplayName: Andie Hunt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-25T18:35:50.943Z
Answers.LastActivityDate: 2015-03-25T18:35:50.943Z
Answers.UserDisplayName: Andie Hunt
Body: <p>Sending reports by email is a really nice feature in CiviCRM. This is done by creating a specific cron job for each report.</p>
  
  <p>However, this will be sent only at the intervals given. And they are "daily", "hourly" or "every time cron job is run". I would love to send some reports on a weekly basis, or even monthly basis. Suggestions on the forum is to set the cron to run only once a week, but I need to run the cron every minute.</p>
  
  <p>Is there any way to send, by email, specific reports automatically on a weekly basis?</p>
  
Tags: <email><civireport><cron-job>
Title: Cron sending reports weekly
ThreadText: # Cron sending reports weekly
  
  (Asked by: username_0 on 2015-03-25)
  
  Sending reports by email is a really nice feature in CiviCRM. This is done by creating a specific cron job for each report.
  
  However, this will be sent only at the intervals given. And they are "daily", "hourly" or "every time cron job is run". I would love to send some reports on a weekly basis, or even monthly basis. Suggestions on the forum is to set the cron to run only once a week, but I need to run the cron every minute.
  
  Is there any way to send, by email, specific reports automatically on a weekly basis?
  
  **Tags:** email, civireport, cron-job
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-03-25. Score: 12 | Accepted answer
  
  You can set up cron jobs besides the main one driving all the scheduled jobs on the Scheduled Jobs page.  The way to do it is explained at http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs#ManagingScheduledJobs-PHPclimethod
  You might have your main job going every 10 minutes like:
  */10 * * * * php /path/to/civicrm/bin/cli.php -s site -u user -p password -e Job -a execute
  
  You'll just need to add a new one for the report, let's say to send the report instance with the ID of 123 every Monday at 8:00:
  0 8 * * 1 php /path/to/civicrm/bin/cli.php -s site -u user -p password -e Job -a mail_report --instanceId=123
  
  You don't need anything in the main Scheduled Jobs page for this--this is 100% separate.
  Back in the old days, this is how you had to do all scheduled jobs!  Uphill--both ways!
  
  > **Comments:**
  > **username_3**: can you extend your answer to include a second parameter - for mail_report, that would be 'format' ? Is that `...-e Job -a mail_report --instanceId=123&format=csv` ?  
  > **username_2**: I don't have time to test it right now, but I'm pretty sure you want to do  `... --instanceId=123 --format=csv`  
  
  ---
  
  ### Answer by username_1 on 2015-06-23. Score: 4
  
  As noted there are various ways documented for [scheduling jobs](http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs#ManagingScheduledJobs-Command-lineSyntaxforRunningJobs). At our organisation we wanted an easy way to allow our users to set up scheduled email reports and came up with a shared Google Sheet which lets people enter a report instance Id and reporting frequency.
  
  The Sheet uses Google Apps Script to trigger the report generation via the URL method. The template and code has been written up here <https://mashe.hawksey.info/2015/06/custom-regular-reporting-from-civicrm-with-google-sheets-and-google-apps-script/> (Disclosure: I'm the author)
  
  [We also extended the solution to extract csv attachments and import into separate Google Sheets]
  
  
  ---
  
  