PHPackages                             blackbird/selective-cron - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. blackbird/selective-cron

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

blackbird/selective-cron
========================

1.0.0(9mo ago)021MITPHPPHP &gt;=8.1

Since Aug 21Pushed 9mo agoCompare

[ Source](https://github.com/blackbird-agency/magento-2-selective-cron)[ Packagist](https://packagist.org/packages/blackbird/selective-cron)[ RSS](/packages/blackbird-selective-cron/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Selective Cron Module for Magento 2
===================================

[](#selective-cron-module-for-magento-2)

[![Latest Stable Version](https://camo.githubusercontent.com/2d009d9dd636287bbaf07d40721ec1fae3fde052c796252485d91bcabc277057/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626c61636b626972642f73656c6563746976652d63726f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/blackbird/selective-cron)[![License: MIT](https://camo.githubusercontent.com/b1f296b46a214826cff844044ccbc4067c51296b76d5571810ce152f6160404e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f626c61636b626972642d6167656e63792f6d6167656e746f2d322d73656c6563746976652d63726f6e2e7376673f7374796c653d666c61742d737175617265)](./LICENSE)

The Selective Cron module allows you to selectively execute only specific cron jobs. This is useful for debugging, testing, or when you want to run only certain cron jobs without affecting others.

Features
--------

[](#features)

- Configuration in the admin panel to select which cron jobs to execute
- Custom command line interface similar to `cron:run` to execute only selected cron jobs
- Dedicated database table to track scheduled cron jobs
- Automatic execution of selected cron jobs at their scheduled times
- Continuous scheduling of new job instances according to their own periodicity
- Dedicated logging for selective cron execution

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Magento &gt;= 2.4.4

Setup
-----

[](#setup)

### Get the package

[](#get-the-package)

**Zip Package:**

Unzip the package in app/code/Blackbird/SelectiveCron, from the root of your Magento instance.

**Composer Package:**

```
composer require blackbird/selective-cron

```

### Install the module

[](#install-the-module)

Go to your Magento root, then run the following Magento command:

```
php bin/magento setup:upgrade

```

**If you are in production mode, do not forget to recompile and redeploy the static resources, or to use the `--keep-generated` option.**

Configuration
-------------

[](#configuration)

1. Go to Stores &gt; Configuration &gt; Advanced &gt; System &gt; Cron (Selective Cron)
2. Select the cron jobs you want to execute
3. Save the configuration

When you save the configuration, the module will automatically:

- Clear the existing selective cron schedule
- Create new schedule entries for the selected cron jobs

Usage
-----

[](#usage)

The module provides multiple ways to execute and manage the selected cron jobs:

### Automatic Execution

[](#automatic-execution)

The module includes two cron jobs for automatic execution:

1. **Execution Cron Job**: Runs every minute to check for and execute any scheduled selective cron jobs that are due to run. This ensures that your selected cron jobs run at their scheduled times without manual intervention.
2. **Scheduling Cron Job**: Runs every 15 minutes to check for jobs that need new instances and adds them to the schedule table. This ensures that new instances of selected cron jobs are continuously added according to their own periodicity.

The scheduling mechanism:

- Calculates the next run time based on each job's cron expression
- Ensures that there's always at least one pending instance for each selected job
- Schedules new instances ahead of time (up to 1 hour in advance)
- Respects each job's individual schedule (e.g., hourly, daily, weekly)

### Manual Execution

[](#manual-execution)

To manually run the selected cron jobs, use the following command:

```
bin/magento cron:run:selective
```

This command will:

1. Check if there are any pending jobs in the selective cron schedule
2. Execute any jobs that are due to run
3. Update the job status in the schedule table

### System Crontab Integration

[](#system-crontab-integration)

The module provides commands to install and remove the selective cron job from the system crontab:

#### Installing in System Crontab

[](#installing-in-system-crontab)

To install the selective cron job in the system crontab, use the following command:

```
bin/magento cron:install:selective
```

This command will:

1. Check if the selective cron functionality is enabled in the configuration
2. Add a crontab entry to run `bin/magento cron:run:selective` every minute
3. The entry will only be added if the selective cron functionality is enabled

If crontab entries already exist, you can use the `--force` option to overwrite them:

```
bin/magento cron:install:selective --force
```

#### Removing from System Crontab

[](#removing-from-system-crontab)

To remove the selective cron job from the system crontab, use the following command:

```
bin/magento cron:remove:selective
```

This command will:

1. Remove only the selective cron entries from the system crontab
2. Leave other Magento cron entries intact

Database
--------

[](#database)

The module creates a `selective_cron_schedule` table that mirrors Magento's `cron_schedule` table. This table stores information about scheduled selective cron jobs, including:

- Job code
- Status (pending, running, success, error, missed)
- Scheduled time
- Execution time
- Completion time
- Error messages (if any)

Logging
-------

[](#logging)

Logs are stored in `var/log/selective_cron.log`

Support
-------

[](#support)

- If you have any issue with this code, feel free to [open an issue](https://github.com/blackbird-agency/magento-2-selective-cron/issues/new).
- If you want to contribute to this project, feel free to [create a pull request](https://github.com/blackbird-agency/magento-2-selective-cron/compare).

Contact
-------

[](#contact)

For further information, contact us:

- by email:
- or by form: [https://black.bird.eu/en/contacts/](https://black.bird.eu/contacts/)

Authors
-------

[](#authors)

- [**Perrine Verbrugghe**](https://github.com/perrine-blackbird) - *Maintainer* -
- [**Blackbird Team**](https://github.com/blackbird-agency) - *Contributor* -

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

***That's all folks!***

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance58

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

270d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12445118?v=4)[anthony-blackbird](/maintainers/anthony-blackbird)[@anthony-blackbird](https://github.com/anthony-blackbird)

---

Top Contributors

[![perrine-blackbird](https://avatars.githubusercontent.com/u/112379583?v=4)](https://github.com/perrine-blackbird "perrine-blackbird (2 commits)")

### Embed Badge

![Health badge](/badges/blackbird-selective-cron/health.svg)

```
[![Health](https://phpackages.com/badges/blackbird-selective-cron/health.svg)](https://phpackages.com/packages/blackbird-selective-cron)
```

###  Alternatives

[snowdog/module-menu

Provides powerful menu editor to replace category based menus in Magento 2

3271.7M5](/packages/snowdog-module-menu)[baldwin/magento2-module-url-data-integrity-checker

Magento 2 module which can find potential url related problems in your catalog data

281773.3k](/packages/baldwin-magento2-module-url-data-integrity-checker)[sivaschenko/magento2-clean-media

Magento 2 media analysis and cleanup

96231.9k](/packages/sivaschenko-magento2-clean-media)[yireo/magento2-extensionchecker

Scan the code of a Magento module

96151.6k3](/packages/yireo-magento2-extensionchecker)[graycore/magento2-graphql-introspection-cache

1015.2k](/packages/graycore-magento2-graphql-introspection-cache)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
