#!/usr/bin/env bash set -e function log_to_dockerout { cd /var/log/firebird while true do for i in $(ls *.log) do if [ -z "$(pgrep -f ${i})" ] ; then echo Processing ${i} > /var/log/dockerout tail -f /var/log/firebird/$i 2> /dev/null | while read fread; do echo "[${i}]: ${fread}" >> /var/log/dockerout; :> /var/log/firebird/$i; done & fi done sleep 10 done } function sec_init { cat < /etc/firebird/check-database.conf rm -f $(cat /etc/firebird/check-database.conf) isql-fb << EOF CREATE DATABASE "$(cat /etc/firebird/check-database.conf)"; EOF } if [ ! -f /secrets/FB3_SYSDBA_PWD ]; then mkdir -p /secrets echo $RANDOM$RANDOM > /secrets/FB3_SYSDBA_PWD echo "Setting SYSDBA's random password: "$( cat /secrets/FB3_SYSDBA_PWD ) fi _SYSDBA_PWD=$(cat /secrets/FB3_SYSDBA_PWD) # Вынос security3.fdb на ПМЖ [[ ${EXT_SECURITY} && ${EXT_SECURITY}="true" ]] && \ { [ ! -d /data/security3.fdb ] && cp /var/lib/firebird/secdb/security3.fdb /data/security3.fdb; } # Создаем символические ссылки на конфигурационные файлы for i in $(ls -d /configs/*.conf); do ln -sf ${i} /etc/firebird/;done [ -f /secrets/cluster.conf ] && ln -sf /secrets/cluster.conf /usr/lib64/firebird/plugins/ sec_init checkbase_init mkfifo /var/log/dockerout tail -f /var/log/dockerout & log_to_dockerout & exec "$@"