https://github.com/antoonline/bash-script-wordpress-docker-run-cron
This script locates running WordPress instances in Docker containers and triggers the execution of their cron jobs. It iterates through each WordPress instance, changes to the WordPress root directory inside the container, and runs the `wp-cron.php` script as the `www-data` user.
https://github.com/antoonline/bash-script-wordpress-docker-run-cron
cron docker ubuntu wordpress
Last synced: 3 months ago
JSON representation
This script locates running WordPress instances in Docker containers and triggers the execution of their cron jobs. It iterates through each WordPress instance, changes to the WordPress root directory inside the container, and runs the `wp-cron.php` script as the `www-data` user.
- Host: GitHub
- URL: https://github.com/antoonline/bash-script-wordpress-docker-run-cron
- Owner: AntoOnline
- Created: 2023-04-25T10:46:05.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-04-30T23:38:56.000Z (about 2 years ago)
- Last Synced: 2025-01-14T08:14:15.636Z (5 months ago)
- Topics: cron, docker, ubuntu, wordpress
- Language: Shell
- Homepage: https://anto.online
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# WordPress Cron Runner
This script is designed to run the WordPress cron (`wp-cron.php`) for all running Docker containers with a WordPress instance.
## Requirements
- Docker
- Bash## Usage
1. Make sure the `wordpress-docker-run-cron.sh` script is executable:
```
chmod +x wordpress-docker-run-cron.sh
```2. Run the script:
```
./wordpress-docker-run-cron.sh
```The script will identify all running Docker containers with a WordPress instance, and then execute the `wp-cron.php` file for each of them.
## How it works
The script performs the following steps:
1. Retrieves the container names of all running WordPress instances.
2. Iterates through the container names and runs the `wp-cron.php` file for each instance.The script will output the container names of the running WordPress instances and display a message indicating that the cron has been run for each instance. After completing the process for all instances, the script will display a message indicating that all WordPress instances have run the cron.
## License
This project is licensed under the MIT License.
## Want to connect?
Feel free to contact me on [Twitter](https://twitter.com/OnlineAnto), [DEV Community](https://dev.to/antoonline/) or [LinkedIn](https://www.linkedin.com/in/anto-online) if you have any questions or suggestions.
Or just visit my [website](https://anto.online) to see what I do.