I have an apache app container. My docker entrypoint is something like this:
#!/bin/bash
set -euo pipefail
declare MOODLE_DATA=/var/www/moodledata
# install only if executed without CMD parameter
if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [ ! -e config.php ]; then
# COPY LOCAL CODE FROM /usr/local/code
else
echo >&2 "MOODLE CODE FOUND: SKIP CREATION"
fi
# database
echo "Checking database status..."
#wait till is ready for connections
dockerize -wait tcp://db:3306 -timeout 20s
# prevent container exit by php return value
set +e
php /var/www/html/admin/cli/check_database_schema.php
dbStatus=$?
if [ $dbStatus -eq 2 ]; then
echo >&2 "CREATING DATABASE...."
# som code
echo >&2 "DATABASE CREATED"
elif [ $dbStatus -eq 0 ]; then
echo >&2 "DATABASE FOUND: SKIP CREATION"
else
echo >&2 "Could not install Database due to errors!"
fi
echo >&2 "Starting web server..."
fi
exec "$@"
It takes quite long to execute, about 5 minutes so i would like to show some info to our users about the installation process.
Is there a way to echo not only to console, but also to an html file? Any script, command to make it simple?
My idea would be to have an html template like the one below, insert text to body and auto refresh every 5':
<html>
<head>
<title>Show installation</title>
<meta http-equiv="refresh" content="5" >
</head>
<body>
</body>
</html>
However I run the web server just at the end exec "$@". How could I fix it? If I run it before the rest of the script it does not go on with the script