Setting up crons

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 23, 2023   (RSS)

By mark99 - October 23, 2023

Are there any guides on how to create scheduled tasks inside CMS Builder itself? The 'Scheduled Tasks' option under the admin area only lists those that have already been set, so I'm clearly overlooking something somewhere. Just asking as I'm trying to debug an annoying issue that has cropped up after upgrading from 3.59 to 3.62 (not ready to report this yet as I have more things left to try first).

Also how can I force a specific task to run outside of its time period, since 'Run Now' will skip the ones I want to test if it's not the right time to run them.

By Dave - October 23, 2023

Hi Mark, 

You can find a sample cron plugin here with inline instructions: /cmsb/plugins/cron-example.php  

We sometimes include a "Run Manually" link on the plugin menu for crons we want to be able to run on demand, but another way might be to erase that cron job's entries from the cron log  here: admin.php?menu=_cron_log  That way it will think it hasn't run recently when you click "Run Now".

Regarding removing the trailing closing PHP tag, it's not required and removing it is something everyone has started doing more industry-wide.  The reasoning behind this recommendation is to prevent accidental whitespace or new lines being added after the closing tag, which could lead to unwanted output or errors like "Headers already sent".

We've been upgrading our code recently to match the current industry standards (which came into being long after CMSB was first released) and that particular standard is part of a PHP standardization specification called PSR-12:  

Hope that helps!  Let me know any questions.  

Dave Edis - Senior Developer