Test in branch test eingefügt
[kivitendo-erp.git] / Test / bin / remove-database
1 #!/bin/bash
2 set -e
3
4 echo "GUI herunterfahren ..."
5 systemctl stop apache2
6
7 echo "Lösche bestende Datenbanken ..."
8 su postgres -c "psql -c 'DROP DATABASE IF EXISTS kivitendo_auth;'"
9 su postgres -c "psql -c 'DROP DATABASE IF EXISTS firma;'"
10
11 echo "Lösche kivitendo-user"
12 su postgres -c "psql -c 'DROP USER kivitendo;'"
13
14 echo "GUI starten ..."
15 systemctl start apache2
16
17 main=$(ls -d /etc/postgresql/*/main/)
18 awk '/kivitendo/ {
19                 next; }
20         {print;}
21         ' $main/pg_hba.conf > /tmp/pg_hba.conf
22 mv /tmp/pg_hba.conf $main/pg_hba.conf
23 chown postgres:postgres $main/pg_hba.conf
24
25
26 echo "ok."
27