forked from norman/fusionpbx-install.sh-github-mirror
Create create.sh
This commit is contained in:
28
debian/resources/postgresql/create.sh
vendored
Normal file
28
debian/resources/postgresql/create.sh
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/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
|
||||||
|
sudo -u postgres psql -c "SET client_encoding = 'UTF8';";
|
||||||
|
|
||||||
|
#add the database users and databases
|
||||||
|
sudo -u postgres psql -c "CREATE DATABASE fusionpbx;";
|
||||||
|
sudo -u postgres psql -c "CREATE DATABASE freeswitch;";
|
||||||
|
|
||||||
|
#add the users and grant permissions
|
||||||
|
sudo -u postgres psql -c "CREATE ROLE fusionpbx WITH SUPERUSER LOGIN PASSWORD '$database_password';"
|
||||||
|
sudo -u postgres psql -c "CREATE ROLE freeswitch WITH SUPERUSER LOGIN PASSWORD '$database_password';"
|
||||||
|
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE fusionpbx to fusionpbx;"
|
||||||
|
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE freeswitch to fusionpbx;"
|
||||||
|
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE freeswitch to freeswitch;"
|
||||||
|
|
||||||
|
#restart postgres
|
||||||
|
service postgresql restart
|
||||||
Reference in New Issue
Block a user