# In seconds
timeout=60
wait=2
try=0
is_ready=false
printf "Waiting MySQL to initialize ..."
while [[ $is_ready == false ]] && [[ $try -lt $timeout ]];do
let try=try+wait
if wp --allow-root --skip-plugins --skip-themes --skip-packages db check &>/dev/null;then
is_ready=true
echo " started"
elif [[ $try -ge $timeout ]];then
echo " timeout"
exit 1
else
printf "."
sleep $wait
fi
done
Code language: Bash (bash)
Leave a Reply