Cron
February 17, 2026 · View on GitHub
Madock provides built-in cron support for running scheduled tasks in your PHP projects.
Commands
Enable cron:
madock cron:enable
Disable cron:
madock cron:disable
How It Works
When cron is enabled:
- A cron process starts inside the PHP container
- Custom cron jobs from configuration are installed (if defined)
- Platform-specific cron jobs are installed automatically:
- Magento 2: runs
bin/magento cron:install(installs Magento's built-in cron) - Shopify: installs Laravel scheduler cron job automatically
- Magento 2: runs
- The setting persists across container restarts
Custom Cron Jobs
You can define custom cron jobs in your project's config.xml. These jobs will be installed automatically when cron is enabled and removed when disabled.
Configuration
Add jobs to the <cron> section in your config:
<cron>
<enabled>false</enabled>
<jobs>
<job>* * * * * cd /var/www/html && php bin/console scheduled:run</job>
<job>*/5 * * * * cd /var/www/html && php artisan schedule:run</job>
<job>0 * * * * cd /var/www/html && php bin/console cache:clear</job>
</jobs>
</cron>
Important Notes
- XML escaping: Use
&instead of&in commands (e.g.,cmd1 && cmd2) - Jobs run as the
www-datauser inside the container - Each
<job>element should contain a complete cron entry (schedule + command) - Jobs are installed/removed together with
cron:enableandcron:disable
Cron Schedule Format
┌───────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌───────────── day of month (1-31)
│ │ │ ┌───────────── month (1-12)
│ │ │ │ ┌───────────── day of week (0-6, Sunday=0)
│ │ │ │ │
* * * * * command
Example Jobs by Platform
Shopware:
<job>* * * * * cd /var/www/html && php bin/console scheduled-task:run</job>
<job>* * * * * cd /var/www/html && php bin/console messenger:consume</job>
Laravel/Shopify:
<job>* * * * * cd /var/www/html && php artisan schedule:run</job>
Symfony:
<job>* * * * * cd /var/www/html && php bin/console messenger:consume async</job>
PrestaShop:
<job>*/15 * * * * cd /var/www/html && php bin/console prestashop:update:configuration</job>
Viewing Cron Logs
Magento 2
Check the Magento cron log:
madock cli "tail -f var/log/cron.log"
Check system cron log:
madock cli "tail -f var/log/system.log | grep -i cron"
View container logs
madock logs php
Verifying Cron Status
Check if cron jobs are running:
madock cli "php bin/magento cron:status"
List scheduled cron jobs:
madock cli "php bin/magento cron:run --group=default -vvv"
Troubleshooting
Cron not running
- Verify cron is enabled: check your project's
config.xmlfor<cron><enabled>true</enabled></cron> - Rebuild containers:
madock rebuild - Check container logs:
madock logs php
Cron jobs stuck
Clear cron schedule:
madock cli "php bin/magento cron:remove"
madock cli "php bin/magento cron:install"
Platform Support
| Platform | Cron Support |
|---|---|
| Magento 2 | ✅ Full support |
| Shopware | ✅ Full support |
| PrestaShop | ✅ Full support |
| Shopify | ✅ Full support |
| Custom PHP | ✅ Configurable |