postgres: handle restores without associated systemd service

This commit is contained in:
Jörg Thalheim
2024-06-14 11:14:49 +02:00
parent c47bd20f29
commit fc9a051498

View File

@@ -159,8 +159,12 @@ in
if [[ -e "${current}" ]]; then if [[ -e "${current}" ]]; then
( (
systemctl stop ${lib.concatStringsSep " " db.restore.stopOnRestore} ${
trap "systemctl start ${lib.concatStringsSep " " db.restore.stopOnRestore}" EXIT lib.optionalString (db.restore.stopOnRestore != [ ]) ''
systemctl stop ${builtins.toString db.restore.stopOnRestore}
trap "systemctl start ${builtins.toString db.restore.stopOnRestore}" EXIT
''
}
mkdir -p "${folder}" mkdir -p "${folder}"
runuser -u postgres -- dropdb "${db.name}" runuser -u postgres -- dropdb "${db.name}"