postgresql: add backup and restore

This commit is contained in:
Jörg Thalheim
2024-06-05 18:37:31 +02:00
parent c0d8aaf73a
commit 0dc3b9f056
6 changed files with 171 additions and 75 deletions

View File

@@ -63,12 +63,15 @@ in
preHook = ''
set -x
declare -A preCommandErrors
${lib.concatMapStringsSep "\n" (state: ''
echo "Running pre-backup command for ${state.name}"
if ! ${state.preBackupCommand} then
preCommandErrors["${state.name}"]=1
fi
'') (lib.attrValues config.clanCore.state)}
${lib.concatMapStringsSep "\n" (
state:
lib.optionalString (state.preBackupCommand != null) ''
echo "Running pre-backup command for ${state.name}"
if ! ( ${state.preBackupCommand} ) then
preCommandErrors["${state.name}"]=1
fi
''
) (lib.attrValues config.clanCore.state)}
'';
postPrune = ''
# report any preBackupCommand errors