---
title: "Script Executor Best Practices"
slug: "script-executor-best-practices"
updated: 2026-06-08T21:47:09Z
published: 2026-06-08T21:47:09Z
canonical: "documentation.decisions.com/script-executor-best-practices"
stale: true
---

> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Script Executor Best Practices

### Integrating SQLSRV Module in ProcessMaker

To ensure proper integration of the [SQLSRV](https://www.php.net/manual/en/book.sqlsrv.php) module in ProcessMaker, see the example: [PHP Executor with the SQLSRV Module](/v1/docs/example-php-executor-with-the-sqlsrv-module).

### Configure Crontab to Run Every Minute

Configure the system crontab to run Laravel’s scheduler once per minute. This ensures scheduled tasks execute consistently and helps prevent duplicate executions.

1. [Create a new PHP Script Executor.](/v1/docs/script-executor-management#create-a-new-script-executor)
2. Enter the following command:

```plaintext
* * * * * 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.
