Commit 8ed298af authored by Abhishek's avatar Abhishek
Browse files

wait added in script

parent e84b7134
Pipeline #11803 skipped with stage
......@@ -37,12 +37,13 @@ echo " -> Using Moodle URL: $MOODLE_URL"
echo " -> Using Backend URL: $BACKEND_URL"
# --- THIS IS THE FIX ---
# Instead of checking for a file, we now poll the database directly.
# The presence of the 'version' record in the config table is the true
# indicator that the initial installation has successfully completed.
# We use an 'until' loop. This will continue to run as long as the command
# fails (returns a non-zero exit code). It will only stop when the mysql
# command is 100% successful, which guarantees the database is fully installed.
echo " -> Waiting for Moodle first-time installation to complete..."
timeout=300 # 5 minute timeout
while ! docker exec "$DB_CONTAINER_NAME" mysql -u root -p"$DB_ROOT_PASSWORD" "$DB_NAME" -e "SELECT * FROM mdl_config WHERE name = 'version';" | grep -q "version"; do
until docker exec "$DB_CONTAINER_NAME" mysql -u root -p"$DB_ROOT_PASSWORD" "$DB_NAME" -e "SELECT 1 FROM mdl_config WHERE name = 'version' LIMIT 1;" > /dev/null 2>&1
do
timeout=$((timeout - 5))
if [ $timeout -le 0 ]; then
echo "❌ ERROR: Moodle installation timed out after 5 minutes."
......@@ -55,7 +56,6 @@ while ! docker exec "$DB_CONTAINER_NAME" mysql -u root -p"$DB_ROOT_PASSWORD" "$D
done
echo "✅ Moodle installation complete (database version found)."
# --- Pre-flight Checks & Plugin Install (Step 1) ---
if ! docker ps --format '{{.Names}}' | grep -qw "$MOODLE_CONTAINER"; then echo "❌ Moodle container not running." && exit 1; fi
if [ ! -f "$PLUGIN_ZIP_NAME" ]; then echo "❌ Plugin ZIP file not found." && exit 1; fi
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment