SUB: Setting up CRON jobs

Automating recurring capabilities using the subscription extension

Step-by-step guide

On the server where you have Magento platform installed open up your CRON configuration

  1. Example: "crontab -e" (assuming you are logged in under the same user which is running your apache or Nginx
  2. Add the code below 
###### Native Magento 2 CRON jobs
* * * * * flock -n /var/www/html/var/locks/cron-run.lock php /var/www/html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/html/var/log/magento.cron.log
* * * * * php /var/www/html/update/cron.php >> /var/www/html/var/log/update.cron.log
* * * * * php /var/www/html/bin/magento setup:cron:run >> /var/www/html/var/log/setup.cron.log

### mPower CRON jobs
*/5 * * * * flock -n /var/www/html/var/locks/sub-process.lock php /var/www/html/bin/magento tnw_subscriptions:process >> /var/www/html/var/log/sub-processing.cron.log

First three lines are standard Magento CRON jobs, which you should already have, those are configured to run every minute (per Magento documentation). The only change we suggest is to add "flock" capability to make sure the CRON won't run if the other one has not finished running yet.

The last two lines are what you will need to trigger (every 5 minutes). The first one automatically generates upcoming quotes of the upcoming orders and the last one does the processing of orders.