ScoDoc/tools/create_users_database.sh

23 lines
589 B
Bash
Raw Permalink Normal View History

#!/bin/bash
# Create USERS database for ScoDoc 8
# This script must be executed as root
#
# $db_name is passed as an environment variable
2021-08-02 10:34:28 +02:00
# Le répertoire de ce script:
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source "$SCRIPT_DIR/config.sh"
source "$SCRIPT_DIR/utils.sh"
check_uid_root "$0"
# 1--- CREATION UTILISATEUR POSTGRESQL
init_postgres_user
# 2--- CREATION BASE UTILISATEURS
echo 'Creating postgresql database for users:' "$SCODOC_USER_DB"
su -c "createdb -E UTF-8 -p $POSTGRES_PORT -O $SCODOC_USER $SCODOC_USER_DB" "$POSTGRES_SUPERUSER"