2019-04-21 21:13:03 +00:00
|
|
|
#!/bin/bash
|
2019-04-13 21:49:49 +00:00
|
|
|
set -eu
|
|
|
|
|
2019-04-21 21:13:03 +00:00
|
|
|
WAIT_DB_HOST=${TRAVELYNX_DB_HOST}
|
|
|
|
WAIT_DB_PORT=5432
|
|
|
|
|
|
|
|
wait_for_db() {
|
|
|
|
set +e
|
|
|
|
for i in $(seq 1 ${WAIT_DB_TIMEOUT:-5})
|
|
|
|
do
|
|
|
|
(echo >/dev/tcp/${WAIT_DB_HOST}/${WAIT_DB_PORT}) &>/dev/null
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
set -e
|
|
|
|
}
|
|
|
|
|
2019-04-13 21:49:49 +00:00
|
|
|
if [ ! -f travelynx.conf ]
|
|
|
|
then
|
|
|
|
echo "The configuration file is missing"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-04-16 16:48:32 +00:00
|
|
|
if [ \
|
|
|
|
"${TRAVELYNX_MAIL_DISABLE:-0}" -eq 0 \
|
|
|
|
-a "${TRAVELYNX_MAIL_HOST:-unset}" != "unset" \
|
|
|
|
]
|
|
|
|
then
|
|
|
|
export EMAIL_SENDER_TRANSPORT=SMTP
|
|
|
|
export EMAIL_SENDER_TRANSPORT_HOST=${TRAVELYNX_MAIL_HOST}
|
|
|
|
export EMAIL_SENDER_TRANSPORT_PORT=${TRAVELYNX_MAIL_PORT:-25}
|
|
|
|
fi
|
|
|
|
|
2019-04-21 21:13:03 +00:00
|
|
|
wait_for_db
|
|
|
|
|
2019-04-13 21:49:49 +00:00
|
|
|
perl index.pl database migrate
|
|
|
|
|
2019-04-16 16:48:32 +00:00
|
|
|
exec /usr/local/bin/hypnotoad -f index.pl
|