ScoDoc/tools/create_database.sh

23 lines
528 B
Bash
Executable File

#!/bin/bash
# Create database for a ScoDoc instance
# This script must be executed as postgres user
#
# $db_name is passed as an environment variable
source config.sh
source utils.sh
if [ $(id -n -u) != "$POSTGRES_SUPERUSER" ]
then
die "$0 must be run as user $POSTGRES_SUPERUSER"
fi
# 1--- CREATION UTILISATEUR POSTGRESQL
init_postgres_user
# 2--- CREATION BASE UTILISATEURS
echo 'Creating postgresql database for users:' "$SCODOC_USER_DB"
createdb -E UTF-8 -p "$POSTGRES_PORT" -O "$POSTGRES_USER" "$SCODOC_USER_DB"