{"id":20329337,"url":"https://github.com/ddev/ddev-cron","last_synced_at":"2025-08-16T05:34:47.245Z","repository":{"id":37217111,"uuid":"493892311","full_name":"ddev/ddev-cron","owner":"ddev","description":"Schedule commands to execute within DDEV","archived":false,"fork":false,"pushed_at":"2025-04-11T00:37:13.000Z","size":143,"stargazers_count":25,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-11T20:45:52.578Z","etag":null,"topics":["ddev-get","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ddev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["ddev"],"custom":["https://www.paypal.com/donate/?hosted_button_id=MCNCSZHC7LHSQ","https://ddev.com/support-ddev/"]}},"created_at":"2022-05-19T02:24:31.000Z","updated_at":"2025-04-11T00:36:32.000Z","dependencies_parsed_at":"2024-01-26T03:27:19.553Z","dependency_job_id":"e4cb42ab-f56b-4400-bef0-3a3b94ff463c","html_url":"https://github.com/ddev/ddev-cron","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":"ddev/ddev-addon-template","purl":"pkg:github/ddev/ddev-cron","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddev%2Fddev-cron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddev%2Fddev-cron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddev%2Fddev-cron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddev%2Fddev-cron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ddev","download_url":"https://codeload.github.com/ddev/ddev-cron/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddev%2Fddev-cron/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270671118,"owners_count":24625702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ddev-get","hacktoberfest"],"created_at":"2024-11-14T20:10:13.034Z","updated_at":"2025-08-16T05:34:47.237Z","avatar_url":"https://github.com/ddev.png","language":"Shell","funding_links":["https://github.com/sponsors/ddev","https://www.paypal.com/donate/?hosted_button_id=MCNCSZHC7LHSQ","https://ddev.com/support-ddev/"],"categories":[],"sub_categories":[],"readme":"[![add-on registry](https://img.shields.io/badge/DDEV-Add--on_Registry-blue)](https://addons.ddev.com)\n[![tests](https://github.com/ddev/ddev-cron/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/ddev/ddev-cron/actions/workflows/tests.yml?query=branch%3Amain)\n[![last commit](https://img.shields.io/github/last-commit/ddev/ddev-cron)](https://github.com/ddev/ddev-cron/commits)\n[![release](https://img.shields.io/github/v/release/ddev/ddev-cron)](https://github.com/ddev/ddev-cron/releases/latest)\n\n# DDEV Cron \u003c!-- omit in toc --\u003e\n\n- [Overview](#overview)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [\\*.cron](#cron)\n- [Useful sites and debugging](#useful-sites-and-debugging)\n- [Examples](#examples)\n  - [Logging current time](#logging-current-time)\n  - [Contao cron](#contao-cron)\n  - [Drupal cron](#drupal-cron)\n  - [Laravel cron](#laravel-cron)\n  - [OpenMage cron](#openmage-cron)\n  - [TYPO3 scheduler](#typo3-scheduler)\n  - [WordPress cron](#wordpress-cron)\n- [Credits](#credits)\n\n## Overview\n\nThe [cron command-line utility](https://en.wikipedia.org/wiki/Cron) is a job scheduler on Unix-like operating systems.\n\nThis add-on:\n\n- Helps to execute a command in the web container based on a cron schedule.\n- Installs and runs the cron service inside the web container.\n- Adds an example job that writes out the current time.\n\n*This extension is designed to be a generic implementation. See [Running TYPO3 Cron inside the web container](https://github.com/ddev/ddev-contrib/tree/master/recipes/cronjob) for a specific example of a manual setup.*\n\n## Installation\n\nTo install this add-on, run:\n\n```bash\nddev add-on get ddev/ddev-cron\n# modify/rename/adjust the time.cron file for your needs\ncp .ddev/web-build/time.cron.example .ddev/web-build/time.cron\nddev restart\n```\n\nAfter installation, make sure to commit the `.ddev` directory to version control.\n\n## Usage\n\nThis extension does the following:\n\n- Adds required cron service to the web container.\n- Configures the cron service using `.ddev/web-build/cron.conf`.\n- Adds all `.ddev/web-build/*.cron` files to crontab scheduler.\n\n### *.cron\n\nThis addon uses `*.cron` files to populate crontab. This allows projects to track and manage cron jobs via git.\n\nOn `ddev start`, all `.ddev/web-build/*.cron` files are:\n\n- Copied into the `/etc/cron.d`.\n- Have their permissions updated.\n- Added to crontab.\n\nSee `.ddev/web-build/time.cron.example` and [Examples](#examples) section below for specific example.\n\n## Useful sites and debugging\n\n- [crontab guru](https://crontab.guru/) is a helpful for generating cron schedule expressions.\n- For `crontab` usage, see [crontab man page](https://manpages.debian.org/buster/cron/crontab.1.en.html).\n- Check crontab by running `ddev exec crontab -l`.\n- If you want the cron to run on your local time instead of UTC, make sure to set `timezone` in your `.ddev/config.yaml`.\n- To help debug, connect to the web container session (`ddev ssh`) and manually run the commands to confirm expected results.\n- If you are running a CMS command that requires access to the database, set the environment variable `IS_DDEV_PROJECT=true`\n\n## Examples\n\nThe following examples are provide as guides.\nPRs are welcome for changes and updates for current best practices for specific frameworks.\n\n### Logging current time\n\nThis addon provides an example that can check if the cron service is running.\nEvery minute, it writes the current time (UTC timezone) to `./time.log`.\n\n- Rename `.ddev/web-build/time.cron.example` to `.ddev/web-build/time.cron`\n- Restart the DDEV project to start the time example.\n- After at least a minute, you should see `./time.log` containing the web container's current time.\n\n### Contao cron\n\n- Create a `./.ddev/web-build/contao.cron` file\n- Add the following code to run the Contao scheduler every minute.\n\n```cron\n* * * * * php /var/www/html/vendor/bin/contao-console contao:cron\n```\n\n### Drupal cron\n\n- Create a `./.ddev/web-build/drupal.cron` file\n- Add the following code to run the drupal scheduler every 10 minutes and write to a log file.\n  - `DDEV_PHP_VERSION` value must match your project's PHP version.\n\n```cron\n*/10 * * * * IS_DDEV_PROJECT=true DDEV_PHP_VERSION=8.1 /var/www/html/vendor/bin/drush cron | tee -a /var/www/html/cron-log.txt\n```\n\n### Laravel cron\n\n- Create a `./.ddev/web-build/laravel.cron` file\n- Add the following code to run the laravel scheduler every minute.\n\n```cron\n* * * * * cd /var/www/html \u0026\u0026 IS_DDEV_PROJECT=true php artisan schedule:run \u003e\u003e /dev/null 2\u003e\u00261\n```\n\n### OpenMage cron\n\n- Create a `./.ddev/web-build/openmage.cron` file\n- Add the following code to run the OpenMage scheduler every minute.\n\n```cron\n* * * * * /var/www/html/cron.sh\n```\n\n### TYPO3 scheduler\n\n- Create a `./.ddev/web-build/typo3.cron` file\n- Add the following code to run the typo3 scheduler every minute and write to a log file.\n\n```cron\n* * * * * cd /var/www/html \u0026\u0026 IS_DDEV_PROJECT=true vendor/bin/typo3 scheduler:run -vv | tee -a /var/www/html/scheduler-log.txt\n```\n\n### WordPress cron\n\n- Create a `./.ddev/web-build/wordpress.cron` file\n- Add the following code to trigger the WordPress scheduler.\n\n```cron\n*/15 * * * * IS_DDEV_PROJECT=true DDEV_PHP_VERSION=8.1 cd /var/www/html \u0026\u0026 /usr/local/bin/wp cron event run --due-now 2\u003e\u00261 | tee -a /var/www/html/cron.log\n```\n\n- This configuration will run the WordPress scheduler every 15 minutes and will create a `cron.log` file in the root of your project\n\n## Credits\n\n**Contributed and maintained by [@tyler36](https://github.com/tyler36) based on the original [Running TYPO3 Cron inside the web container](https://github.com/ddev/ddev-contrib/tree/master/recipes/cronjob) by [@thomaskieslich](https://github.com/thomaskieslich)**\n\n**Originally contributed by [@thomaskieslich](https://github.com/thomaskieslich) in \u003chttps://github.com/ddev/ddev-contrib/tree/master/recipes/cronjob\u003e)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddev%2Fddev-cron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fddev%2Fddev-cron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddev%2Fddev-cron/lists"}