fusionpbx-install.sh/debian/resources/postgresql/create.sh

28 lines
766 B
Bash
Raw Normal View History

2017-11-21 06:00:40 +01:00
#!/bin/sh
#move to script directory so all relative paths work
cd "$(dirname "$0")"
#includes
. ../config.sh
#set the working directory
cwd=$(pwd)
cd /tmp
#set client encoding
2018-10-25 18:47:59 +02:00
sudo -u postgres psql -p $database_port -c "SET client_encoding = 'UTF8';";
2017-11-21 06:00:40 +01:00
#add the database users and databases
2018-10-25 18:47:59 +02:00
sudo -u postgres psql -p $database_port -c "CREATE DATABASE fusionpbx;";
2017-11-21 06:00:40 +01:00
#add the users and grant permissions
2018-10-25 18:47:59 +02:00
sudo -u postgres psql -p $database_port -c "CREATE ROLE fusionpbx WITH SUPERUSER LOGIN PASSWORD '$database_password';"
sudo -u postgres psql -p $database_port -c "GRANT ALL PRIVILEGES ON DATABASE fusionpbx to fusionpbx;"
2017-11-21 06:00:40 +01:00
2022-01-16 02:56:22 +01:00
#reload the config
sudo -u postgres psql -p $database_port -c "SELECT pg_reload_conf();"
2017-11-21 06:00:40 +01:00
#restart postgres
2022-01-16 02:56:22 +01:00
#systemctl restart postgresql