-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·27 lines (21 loc) · 850 Bytes
/
start.sh
File metadata and controls
executable file
·27 lines (21 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
set -e
[[ "${PHPBB_INSTALL}" = "true" ]] && rm config.php
[[ "${PHPBB_INSTALL}" != "true" ]] && rm -rf install
db_wait() {
if [[ "${PHPBB_DB_WAIT}" = "true" && "${PHPBB_DB_DRIVER}" != "sqlite3" && "${PHPBB_DB_DRIVER}" != "sqlite" ]]; then
until nc -z ${PHPBB_DB_HOST} ${PHPBB_DB_PORT}; do
echo "$(date) - waiting for database on ${PHPBB_DB_HOST}:${PHPBB_DB_PORT} to start before applying migrations"
sleep 3
done
fi
}
db_migrate() {
if [[ "${PHPBB_DB_AUTOMIGRATE}" = "true" && "${PHPBB_INSTALL}" != "true" ]]; then
echo "$(date) - applying migrations"
su-exec apache php bin/phpbbcli.php db:migrate
fi
}
# Apache gets grumpy about PID files pre-existing
rm -f /run/apache2/httpd.pid
db_wait && db_migrate && exec httpd -DFOREGROUND "$@"