What's a cron task and why do I need one?

On all our commercial versions, AcyMailing can execute automatic processes such as sending your messages (automatic send process of batches of e-mails), generating Newsletters (with the Smart-Newsletter), sending your follow-ups (with the campaign system)...

For those actions to be executed, AcyMailing needs to be triggered regularly, and each time AcyMailing is triggered, it will check if some tasks have to be executed and then do what needs to be done.

A cron task is a system which will automatically trigger AcyMailing without any human intervention.

This is a one-time setup... Once done, you won't have to think about it any more and all automatic actions will work.

 

Create your cron task on our server

As some hosting companies don't enable you to create a cron task on your own server and also because some of our users have no clue what's a cron task, we created a cron service and an easy way to add a cron task directly via your AcyMailing configuration!

So, within two clicks, you will be able to create your cron task:

  • Go on your AcyMailing configuration page
  • Click on the tab Queue process

Create cron

 

 

    • On this interface, you can set AcyMailing to send X e-mails every Y minutes using the automatic only send process.
      Please remember the frequency displayed here is just for security (so that your website won't be triggered too often) but this parameter has no impact on the real cron frequency (they both should have the same value).
    • Click on the button Create/Edit your Cron task.
    • A popup will open and you will directly see your cron url added (you don't have to change it!).
    • Make sure the Cron URL is the right one (you should not have to modify this url!)
    • Activate your Cron Task (if you select "Activated : No", Acyba won't trigger your website any more)
    • Select your frequency to meet your needs
      You can select either Every 15 minutes, Every 30 minutes or Every 1 hour.
    • This frequency should be the same as (or bigger than) the one you specified on the "automatic send process" parameters.
    • Click on the save button.

Create cron

  • That's all you have to do and now our server will trigger your AcyMailing components at the specified frequency.
  • You have to do this procedure only one time, then you can forget about it!
  • On this same popup, you can also see an area Last Report.
    This area enables you to check if your website has been triggered properly by our server and when.
    You can see our local time, the next time your website will be triggered and the last report.
  • You can now close this popup

 

Create your cron task on your own server

If you have the possibility and the knowledge to create a cron task on your own server, then you should do it and stop the cron task on our server to be completely independent from our server.
You can contact your hosting company for directions on how to set it up on your hosting plan.

You should configure the cron on our server (directly via the AcyMailing Configuration page) OR on your server, not both.

You should trigger your AcyMailing cron url at a fixed frequency depending on your needs (every 15 minutes is usually a good frequency)

You can see your cron url on your AcyMailing configuration page, tab Queue process.

Cron url

 

Linux System

You can use one of the following commands depending on your server:

lynx -source "http://www.yourwebsite.com/index.php?option=com_acymailing&ctrl=cron" > /dev/null

Or

wget -O /dev/null "http://www.yourwebsite.com/index.php?option=com_acymailing&ctrl=cron" > /dev/null

If you access your website using an httpS protocol, you may want to use this command instead:

wget --no-check-certificate -O /dev/null "https://www.yourwebsite.com/index.php?option=com_acymailing&ctrl=cron" > /dev/null

Some hosting company block the lynx and wget command in which case you should use the curl one:

curl --silent --compressed "http://www.yourwebsite.com/index.php?option=com_acymailing&ctrl=cron" > /dev/null 2>&1

Cron Example

  • If you create your own cron, you can also configure it to trigger AcyMailing every 15 minutes only on specific time range.
    For example, you can send only on Tuesday, Wednesday and Thursday and only from 11am to 3pm with this cron frequency : */15 11-15 * * 2-4
    */15 for the minutes field
    11-15 for the hour field
    * for the day field
    * for the month field
    2-4 for the weekday field​​​​​​

Cron url parameters

This part is for advanced users, really. And if you don't understand it that's because you don't need it!
Some of our clients asked us to be able to separate their crons and instead of having one cron for all AcyMailing processes, have one for the send process, another one for the bounce handling, another for the Smart-Newsletter...

You can add the additional parameter skip in your cron command which should be a list of actions you don't want Acy to execute for this cron.
The skip parameter can have the following values that you can combine by adding each keyword separated by a comma :

  • send : that will skip the send process
  • autonews : to skip the Smart-Newsletter generation
  • schedule : to skip the fact Acy will add the scheduled Newsletters in the queue
  • plugins : to skip our plugin triggers (function onAcyCronTrigger)
  • filters : to skip the execution of automatic filters
  • bounce : to skip the Acy bounce handling
  • abtesting : to skip the checking of waiting A/B tests

Example : http://www.yourwebsite.com/index.php?option=com_acymailing&ctrl=cron&skip=bounce,autonews

Test your cron task

  • We implemented an easy way for you to check that your cron task is working.
  • Go on your AcyMailing configuration page and click on the tab Queue process

Test your cron

  • On the Report area, you can see an option to have AcyMailing sending you a report each time it is triggered.
    So you can turn ON this option and once your done with your tests, you can then turn it Off.
    If you turn ON this option, then AcyMailing will send you an e-mail each time your website is triggered so it should send you an e-mail every 15 minutes (well, depending on your cron frequency).
  • Also, on the Last Cron area, you can see the last time your cron has been triggered, who triggered it and the latest report.

 

My cron does not work?!

If your cron task is not working, you should:

  • Make sure your website can be triggered via your browser:
    Click on your cron url. That will trigger it manually via your browser so you will see if this url can be reached or not.
  • If you use a third-party SEF component, your website may redirect the current page to the SEF one which will break our own cron service.
    So you can either configure your SEF component to not transform non-SEF into SEF urls or directly write your sef cron url on our cron interface.
  • Make sure your website can be triggered by the outside:
    If you have an .htaccess with password protection, your website will obviously not accept to be triggered by an anonymous user.
  • If you use a security component on your Joomla website, this component might block our cron task.
    RSFirewall: You should disable the DoS protection from the Components > RSFirewall > Configuration > Active scanner configuration options.
  • If you use our own web cron service, you should check that our server is allowed to trigger yours.
    Our server IP is 178.23.155.153 and we will trigger your server using the domain name http://yourcrontask.com
  • Our server is located in France... if you use RSFirewall or another security component, please make sure this country is not blocked.
  • If your host is SiteGround and you use our own web cron service but get the error "Could not connect to ..." then please contact them with this message and they will be able to unlock the situation:
    I'm using a web cron service which triggers my website every 15 minutes.
    The service is not working any more and it's apparently due to the fact their server has been filtered.
    Could you please make sure that the server 
    178.23.155.153 is able to trigger my website?
    They trigger my site from the domain http://yourcrontask.com
  • If you use our own server to trigger your website, please make sure you enabled our server IP to trigger your website every X minutes! (you might block it if you have some security checks on the number of connections per IP)
  • Sometimes cron jobs can't trigger an url including a "&" or can only trigger a script (instead of an url).
    In that case, you should create a file called "acymail.php" at the root of your website including the code:
    Show/Hide php code
    View source
    <?php
    $_SERVER['REQUEST_METHOD'] = 'GET';
    $_SERVER['PHP_SELF'] = '/acymail.php';
    $_SERVER['REQUEST_URI'] = '/acymail.php';
    $_SERVER['HTTP_HOST'] = 'yourdomain.com';
    $_SERVER['SCRIPT_NAME'] = '';
    $_REQUEST['option'] = 'com_acymailing';
    $_REQUEST['ctrl'] = 'cron';
     include __DIR__.DIRECTORY_SEPARATOR.'index.php';
     

    Then configure your cron to trigger that script.
    Please don't forget to replace yourdomain.com by the url of your own website.
  • If you use CloudFlare, our web cron service may be blocked... you should create a rule in CloudFlare:
    - PATTERN -
    YOURDOMAIN.com/index.php?option=com_acymailing&ctrl=cron
    - RULES -
    Apps: Off, Performance: Off, Security: Off, Always online: off, Cache level: Bypass cache

 

Follow us :