roundcube/rootfs/bin/dbinit

9 lines
317 B
Plaintext
Raw Normal View History

2022-02-18 08:36:32 +00:00
#!/bin/sh
2016-07-13 15:07:43 +00:00
2017-10-06 09:57:54 +00:00
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
2016-07-13 15:07:43 +00:00
if [ $? -ne 1 ]; then
2017-10-06 09:57:54 +00:00
PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -U $DB_USER -d $DB_NAME -f /var/lib/roundcube/SQL/postgres.initial.sql
2016-07-13 15:07:43 +00:00
fi