Script Executor Best Practices

Prev Next

Integrating SQLSRV Module in ProcessMaker

To ensure proper integration of the SQLSRV module in ProcessMaker, see the example: PHP Executor with the SQLSRV Module.

Configure Crontab to Run Every Minute

To ensure consistent task scheduling and avoid duplicate executions, configure your system crontab to run Laravel's scheduler exactly once per minute using the following command in a PHP Script Executor:

* * * * * php artisan schedule:run

Why This Matters

Running php artisan schedule:run more frequently (e.g., every 30 seconds) can lead to unintended duplicate executions of scheduled tasks, such as dispatchDueReports, resulting in inconsistent behavior and potential performance issues.

Implementation Notes

  • Correct Interval: Ensure crontab is not configured to run more often than every minute.

  • Validation Logic (Optional): Within task logic like dispatchDueReports, include safeguards using isDue() or similar validation to confirm that the task has not already been executed within the current minute.

  • System Alerts (Optional): Consider implementing alerts or validation rules to notify administrators if crontab is misconfigured.

  • Testing (Optional): Introduce unit or integration tests to simulate rapid scheduler invocations and validate correct execution behavior.

Applies To

All environments running Laravel scheduled tasks via crontab, including ProcessMaker Platform installations.