#!/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."