roundcube/rootfs/bin/dbinit

9 lines
334 B
Plaintext
Executable File

#!/usr/bin/with-contenv sh
PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -U $DB_USER -d $DB_NAME -c "SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'session')" | grep f
if [ $? -ne 1 ]; then
PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -U $DB_USER -d $DB_NAME -f /var/lib/roundcube/SQL/postgres.initial.sql
fi