func(.env): Add the ability to specify how frequently the cron.php script should run. Default to every 1 minute. (#174)

This commit is contained in:
Gerrit Giliomee
2021-03-26 10:36:35 +02:00
committed by GitHub
parent 4d6ac9b0ce
commit be1d6f66ee
2 changed files with 2 additions and 1 deletions

View File

@@ -194,7 +194,7 @@ EOF
# Ensure Moodle cron jobs are created when running setup with a root user
local -a cron_cmd=("${PHP_BIN_DIR}/php" "${MOODLE_BASE_DIR}/admin/cli/cron.php")
if am_i_root; then
generate_cron_conf "moodle" "${cron_cmd[*]} > /dev/null 2>> ${MOODLE_DATA_DIR}/moodle-cron.log" --run-as "$WEB_SERVER_DAEMON_USER" --schedule "*/1 * * * *"
generate_cron_conf "moodle" "${cron_cmd[*]} > /dev/null 2>> ${MOODLE_DATA_DIR}/moodle-cron.log" --run-as "$WEB_SERVER_DAEMON_USER" --schedule "*/${MOODLE_CRON_MINUTES} * * * *"
else
warn "Skipping cron configuration for Moodle because of running as a non-root user"
fi

View File

@@ -112,3 +112,4 @@ export MOODLE_DATABASE_PASSWORD="${MOODLE_DATABASE_PASSWORD:-}" # only used duri
export PHP_DEFAULT_MEMORY_LIMIT="256M" # only used at build time
# Custom environment variables may be defined below
export MOODLE_CRON_MINUTES="${MOODLE_CRON_MINUTES:-1}" # How frequently to run the moodle cron job. Default to 1 minutes