Answers.Body: <p>Ok,</p>
  <p>The CLI version works out of the box:
  /usr/local/bin/php /home/#dir#/public_html/modules/civicrm/bin/cli.php -s #domain# -u #cronuser# -p #cronpwd# -e Job -a execute</p>
  <p>The HTTP version needs a change in BackdropCMS .htaccess</p>
  <p>.htaccess has this:</p>
  <pre><code># Redirect common PHP files to their new locations.
  RewriteCond %{REQUEST_URI} ^(.*)?/(update.php) [OR]
  RewriteCond %{REQUEST_URI} ^(.*)?/(install.php) [OR]
  RewriteCond %{REQUEST_URI} ^(.*)?/(cron.php)
  RewriteCond %{REQUEST_URI} !core
  RewriteRule ^ %1/core/%2 [L,QSA,R=301]
  </code></pre>
  <p>If you make it this it works:</p>
  <pre><code># Redirect common PHP files to their new locations.
  RewriteCond %{REQUEST_URI} ^(.*)?/(update.php) [OR]
  RewriteCond %{REQUEST_URI} ^(.*)?/(install.php) [OR]
  RewriteCond %{REQUEST_URI} ^(.*)?/(cron.php)
  RewriteCond %{REQUEST_URI} !core
  RewriteCond %{REQUEST_URI} !civicrm
  RewriteRule ^ %1/core/%2 [L,QSA,R=301]
  </code></pre>
  <p>Going to ask for a change of default .htaccess in BackdropCMS</p>
  <p>--</p>
  <p>update:
  This is now part of BackdropCMS core, although made slightly more generic:</p>
  <pre><code>RewriteCond %{REQUEST_URI} !modules
  </code></pre>
  <p>is added to .htaccess</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-14T07:30:14.037Z
Answers.LastActivityDate: 2022-07-14T14:11:25.733Z
Answers.LastEditDate: 2022-07-14T14:11:25.733Z
Answers.UserDisplayName: Catorghans
Answers.Body: <p>I wrote <a href="https://www.drupal.org/project/civicrm_cron" rel="nofollow noreferrer">https://www.drupal.org/project/civicrm_cron</a> a decade ago to make it easier to run CiviCRM on Pantheon. Pantheon already ran Drupal's cron -&gt; by getting Drupal to run CiviCRM's cron, Pantheon ran CiviCRM's cron too.</p>
  <p>The way the D7 module worked was convoluted. It declared a new menu path within Drupal and then wrap[ed a call to that URL with the sitekey value in the querystring using drupal_http_request.</p>
  <p>Basically, Drupal became a proxy for the same URL someone could have added to a crontab or Easycron type service.</p>
  <p>In Backdrop, because the path would be within the paths already managed by Backdrop there would be no need to alter the .htaccess file (or how this is managed in NGINX).</p>
  <p>New Menu Path is defined at <a href="https://git.drupalcode.org/project/civicrm_cron/-/blob/7.x-2.x/civicrm_cron.module#L22" rel="nofollow noreferrer">https://git.drupalcode.org/project/civicrm_cron/-/blob/7.x-2.x/civicrm_cron.module#L22</a></p>
  <p>Call to that path wrapped in hook_cron at <a href="https://git.drupalcode.org/project/civicrm_cron/-/blob/7.x-2.x/civicrm_cron.module#L49" rel="nofollow noreferrer">https://git.drupalcode.org/project/civicrm_cron/-/blob/7.x-2.x/civicrm_cron.module#L49</a></p>
  <p>The part that has likely changes in the last 10 years is <a href="https://git.drupalcode.org/project/civicrm_cron/-/blob/7.x-2.x/civicrm_cron.module#L143" rel="nofollow noreferrer">https://git.drupalcode.org/project/civicrm_cron/-/blob/7.x-2.x/civicrm_cron.module#L143</a></p>
  <p>David Snopek simplified this for D8 with just a hook_cron, but I don't think Backdrop has the equivalent of \Drupal::service('civicrm_cron.cron_runner')</p>
  <p><a href="https://git.drupalcode.org/project/civicrm_cron/-/blob/8.x-1.x/civicrm_cron.module#L143" rel="nofollow noreferrer">https://git.drupalcode.org/project/civicrm_cron/-/blob/8.x-1.x/civicrm_cron.module#L143</a></p>
  <p>It doesn't seem too difficult for someone familiar with Backdrop and CiviCRM to find an approach that would work without needed to modify Backdrop's .htaccess files.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-20T17:04:12.650Z
Answers.Text: oh, nice. I think your module is forked already for backdrop: https://backdropcms.org/project/civicrm_cron. Thanks for the tip (although I still think it should be possible to use without)
Answers.UserDisplayName: Catorghans
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-22T15:16:44.937Z
Answers.Text: Ha! I should have checked that first. I think it's safe to say that at this point the Backdrop community has ported or found a different way to achieve almost anything anyone using D7 would need. Really AMAZING work!
Answers.UserDisplayName: kreynen
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-19T15:34:53.567Z
Answers.LastActivityDate: 2022-02-19T15:34:53.567Z
Answers.UserDisplayName: kreynen
Body: <p>How to do civicrm cron in BackdropCMS?</p>
  <p>when I do in the browser:
  https://&lt;domain.com&gt;/modules/civicrm/bin/cron.php with the proper parameters it gets redirected to:
  https://&lt;domain.com&gt;/modules/civicrm/bin/core/cron.php and then gives a 404</p>
  <p><a href="https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/" rel="nofollow noreferrer">https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/</a> does not show Backdrop yet.</p>
  
Tags: <cron><backdrop>
Title: BackdropCMS & cron
ThreadText: # BackdropCMS & cron
  
  (Asked by: username_0 on 2022-02-12)
  
  How to do civicrm cron in BackdropCMS?
  
  when I do in the browser:
  https://<domain.com>/modules/civicrm/bin/cron.php with the proper parameters it gets redirected to:
  https://<domain.com>/modules/civicrm/bin/core/cron.php and then gives a 404
  
  <https://docs.civicrm.org/sysadmin/en/latest/setup/jobs/> does not show Backdrop yet.
  
  **Tags:** cron, backdrop
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2022-02-14. Score: 3
  
  Ok,
  
  The CLI version works out of the box:
  /usr/local/bin/php /home/#dir#/public\_html/modules/civicrm/bin/cli.php -s #domain# -u #cronuser# -p #cronpwd# -e Job -a execute
  
  The HTTP version needs a change in BackdropCMS .htaccess
  
  .htaccess has this:
  
  ```
  # Redirect common PHP files to their new locations.
  RewriteCond %{REQUEST_URI} ^(.*)?/(update.php) [OR]
  RewriteCond %{REQUEST_URI} ^(.*)?/(install.php) [OR]
  RewriteCond %{REQUEST_URI} ^(.*)?/(cron.php)
  RewriteCond %{REQUEST_URI} !core
  RewriteRule ^ %1/core/%2 [L,QSA,R=301]
  
  ```
  
  If you make it this it works:
  
  ```
  # Redirect common PHP files to their new locations.
  RewriteCond %{REQUEST_URI} ^(.*)?/(update.php) [OR]
  RewriteCond %{REQUEST_URI} ^(.*)?/(install.php) [OR]
  RewriteCond %{REQUEST_URI} ^(.*)?/(cron.php)
  RewriteCond %{REQUEST_URI} !core
  RewriteCond %{REQUEST_URI} !civicrm
  RewriteRule ^ %1/core/%2 [L,QSA,R=301]
  
  ```
  
  Going to ask for a change of default .htaccess in BackdropCMS
  
  --
  
  update:
  This is now part of BackdropCMS core, although made slightly more generic:
  
  ```
  RewriteCond %{REQUEST_URI} !modules
  
  ```
  
  is added to .htaccess
  
  
  ---
  
  ### Answer by username_1 on 2022-02-19. Score: 2
  
  I wrote <https://www.drupal.org/project/civicrm_cron> a decade ago to make it easier to run CiviCRM on Pantheon. Pantheon already ran Drupal's cron -> by getting Drupal to run CiviCRM's cron, Pantheon ran CiviCRM's cron too.
  
  The way the D7 module worked was convoluted. It declared a new menu path within Drupal and then wrap[ed a call to that URL with the sitekey value in the querystring using drupal\_http\_request.
  
  Basically, Drupal became a proxy for the same URL someone could have added to a crontab or Easycron type service.
  
  In Backdrop, because the path would be within the paths already managed by Backdrop there would be no need to alter the .htaccess file (or how this is managed in NGINX).
  
  New Menu Path is defined at <https://git.drupalcode.org/project/civicrm_cron/-/blob/7.x-2.x/civicrm_cron.module#L22>
  
  Call to that path wrapped in hook\_cron at <https://git.drupalcode.org/project/civicrm_cron/-/blob/7.x-2.x/civicrm_cron.module#L49>
  
  The part that has likely changes in the last 10 years is <https://git.drupalcode.org/project/civicrm_cron/-/blob/7.x-2.x/civicrm_cron.module#L143>
  
  David Snopek simplified this for D8 with just a hook\_cron, but I don't think Backdrop has the equivalent of \Drupal::service('civicrm\_cron.cron\_runner')
  
  <https://git.drupalcode.org/project/civicrm_cron/-/blob/8.x-1.x/civicrm_cron.module#L143>
  
  It doesn't seem too difficult for someone familiar with Backdrop and CiviCRM to find an approach that would work without needed to modify Backdrop's .htaccess files.
  
  > **Comments:**
  > **username_0**: oh, nice. I think your module is forked already for backdrop: https://backdropcms.org/project/civicrm_cron. Thanks for the tip (although I still think it should be possible to use without)  
  > **username_1**: Ha! I should have checked that first. I think it's safe to say that at this point the Backdrop community has ported or found a different way to achieve almost anything anyone using D7 would need. Really AMAZING work!  
  
  ---
  
  