DocScoDoc/tools/create_database.sh

21 lines
457 B
Bash
Raw Normal View History

2020-09-26 16:19:37 +02:00
#!/bin/bash
# Create database for a ScoDoc instance
2021-07-27 13:27:21 +02:00
# This script must be executed as root
2020-09-26 16:19:37 +02:00
#
2021-07-23 13:45:56 +02:00
# $db_name is passed as an environment variable
2020-09-26 16:19:37 +02:00
source config.sh
source utils.sh
2021-07-27 13:27:21 +02:00
check_uid_root "$0"
2020-09-26 16:19:37 +02:00
2021-07-23 13:45:56 +02:00
# 1--- CREATION UTILISATEUR POSTGRESQL
init_postgres_user
# 2--- CREATION BASE UTILISATEURS
echo 'Creating postgresql database for users:' "$SCODOC_USER_DB"
2021-07-27 13:27:21 +02:00
su -c "createdb -E UTF-8 -p $POSTGRES_PORT -O $POSTGRES_USER $SCODOC_USER_DB" $POSTGRES_SUPERUSER
2020-09-26 16:19:37 +02:00