Test in branch test eingefügt
[kivitendo-erp.git] / Test / bin / remove-database
diff --git a/Test/bin/remove-database b/Test/bin/remove-database
new file mode 100755 (executable)
index 0000000..5d4fcb0
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/bash
+set -e
+
+echo "GUI herunterfahren ..."
+systemctl stop apache2
+
+echo "Lösche bestende Datenbanken ..."
+su postgres -c "psql -c 'DROP DATABASE IF EXISTS kivitendo_auth;'"
+su postgres -c "psql -c 'DROP DATABASE IF EXISTS firma;'"
+
+echo "Lösche kivitendo-user"
+su postgres -c "psql -c 'DROP USER kivitendo;'"
+
+echo "GUI starten ..."
+systemctl start apache2
+
+main=$(ls -d /etc/postgresql/*/main/)
+awk '/kivitendo/ {
+               next; }
+       {print;}
+       ' $main/pg_hba.conf > /tmp/pg_hba.conf
+mv /tmp/pg_hba.conf $main/pg_hba.conf
+chown postgres:postgres $main/pg_hba.conf
+
+
+echo "ok."
+