Difference between revisions of "Configuration-Cron tab"

From JReviews Documentation
Jump to: navigation, search
Line 8: Line 8:
  
 
<div class="mw-help-field-data small">You can test if the Cron URL you are using is correct, by pasting it in your browser. If it's working correctly you will see the message '''Cron ran successfully.'''</div>
 
<div class="mw-help-field-data small">You can test if the Cron URL you are using is correct, by pasting it in your browser. If it's working correctly you will see the message '''Cron ran successfully.'''</div>
 +
 +
You can add the cron using wget to call the URL like this:
 +
 +
<source lang="bash">
 +
* * * * * wget -O /dev/null -o /dev/null https://yourdomain.com/index.php?option=com_jreviews&format=raw&url=cron&secret=CRON_SECRET
 +
</source> 
 +
 +
If you have problems setting up a cron job to run a URL using '''wget''' or '''lynx''', you can also create a new file on the root if your site, with any name you want, like '''jreviews-cron.php''' with the following code:
 +
 +
<source lang="php">
 +
<?php
 +
file_get_contents('https://yourdomain.com/index.php?option=com_jreviews&format=raw&url=cron&secret=CRON_SECRET
 +
');
 +
</source> 
 +
 +
Then you can setup up the cron to run every minute like this:
 +
 +
<source lang="bash">
 +
* * * * * /usr/local/bin/php /home/user/public_html/jreviews-cron.php
 +
</source> 
 +
 +
Make sure you replace both your site domain and CRON_SECRET with the value from the JReviews dashboard.
 +
 +
If you are having problems with these approaches, make sure you contact your host for help with setting up the cron.
  
 
[[File:conf-cron.png]]
 
[[File:conf-cron.png]]

Revision as of 11:52, 2 November 2019

Setting up the JReviews Cron is required to periodically run maintenance tasks (rebuilding ranks, media counts, purging cache, etc.), and also for processing certain tasks that should not be processed during site visits, like sending emails in bulk.

Although we've built a feature to run certain cron tasks on site visits, not all tasks can be run this way, so setting up the cron is highly recommended.

To setup the cron, use your hosting panel's cron configuration tool and add the Cron URL provided in the JReviews admin dashboard after replacing the secret string with the one shown in the dashboard.

You should setup the cron to run every minute. Not all tasks will be processed every minute, but this is the best way to ensure that all tasks are run periodically.

You can test if the Cron URL you are using is correct, by pasting it in your browser. If it's working correctly you will see the message Cron ran successfully.

You can add the cron using wget to call the URL like this:

* * * * * wget -O /dev/null -o /dev/null https://yourdomain.com/index.php?option=com_jreviews&format=raw&url=cron&secret=CRON_SECRET

If you have problems setting up a cron job to run a URL using wget or lynx, you can also create a new file on the root if your site, with any name you want, like jreviews-cron.php with the following code:

<?php
file_get_contents('https://yourdomain.com/index.php?option=com_jreviews&format=raw&url=cron&secret=CRON_SECRET
');

Then you can setup up the cron to run every minute like this:

* * * * * /usr/local/bin/php /home/user/public_html/jreviews-cron.php

Make sure you replace both your site domain and CRON_SECRET with the value from the JReviews dashboard.

If you are having problems with these approaches, make sure you contact your host for help with setting up the cron.

Conf-cron.png