Compare commits

...

2 Commits

Author SHA1 Message Date
Hugo LAMY
8437099112 update submodules address 2026-02-11 10:21:23 +01:00
asus
d2fda4af76 added server cron handling in wordpress container 2024-04-16 16:42:29 +02:00
2 changed files with 16 additions and 3 deletions

2
.gitmodules vendored
View File

@@ -1,3 +1,3 @@
[submodule "srcs/env_generator"]
path = srcs/env_generator
url = git@bitbucket.org:hugogogo/script_env_generator.git
url = gitea@gitea.hugulumu.com:perso/SCRIPT_env_generator.git

View File

@@ -12,7 +12,6 @@ RESET="\e[0m"
# it gets the ENV variables from .env because specified in the docker-compose.yml file
# this is to make the wp_cron job works
# ! it might not be a very strong solution
#
@@ -77,7 +76,7 @@ else
fi
# installing plugins :
echo -e ${YELLOW}installing plugins...${RESET}
echo -e ${YELLOW}installing plugins..${RESET}
plugins=$(ls ${WP_VOLUME_PLUGINS})
echo $plugins
for dir in $plugins; do
@@ -96,6 +95,20 @@ php wp-cli.phar config set WP_DEBUG_LOG true --raw --path=${WP_VOLUME_DIR}
php wp-cli.phar config set WP_DEBUG_DISPLAY false --raw --path=${WP_VOLUME_DIR}
# if you don't want to rely on wpcron :
# - because it launches on each visit of the website
# - so it can slow it
# - instead creates a real cron job to call the wpcron file regularly
# launch the server cron job, and disable wpcron
# in the container, the crond deamon is started manually, so it is listed with :
# - ps aux
# - kill <PID> to remove it for example
# -> https://stackoverflow.com/questions/37015624/how-to-run-a-cron-job-inside-a-docker-container
php wp-cli.phar config set DISABLE_WP_CRON false --raw --path=${WP_VOLUME_DIR}
echo "* * * * * cd ${WP_VOLUME_DIR}; php ${WP_VOLUME_DIR}/wp-cron.php > /dev/null 2>&1" >> /etc/crontabs/root
crond -f -l 2 >> /var/log/wpcron.log 2>&1 &