Fix DB-Dump
This commit is contained in:
1 parent
a8a00a9f46
commit
912d4b9434
3 files changed
+10
-9
No files matched your search
+6
-6
@@ -121,13 +121,13 @@ dump_postgresql() {
|
||||
check_directory $dump_dir
|
||||
|
||||
# users and roles
|
||||
log $DEBUG "$DBG > \$CONTAINER_EXEC_USER exec -u=postgres $pg_container pg_dumpall --globals-only"
|
||||
$CONTAINER_EXEC_USER exec -u=postgres $pg_container pg_dumpall --globals-only > $dump_dir/_globals.sql 2>>$LOG_FILE
|
||||
log $DEBUG "$DBG > \$CONTAINER_EXEC_USER -u=postgres $pg_container pg_dumpall --globals-only"
|
||||
$CONTAINER_EXEC_USER -u=postgres $pg_container pg_dumpall --globals-only > $dump_dir/_globals.sql 2>>$LOG_FILE
|
||||
|
||||
log $DEBUG "$DBG \$CONTAINER_EXEC_USER exec -u=postgres $pg_container psql -t -c \"select datname from pg_database where not datistemplate\""
|
||||
for db in $($CONTAINER_EXEC_USER exec -u=postgres $pg_container psql -t -c "select datname from pg_database where not datistemplate" 2>>$LOG_FILE); do
|
||||
log $DEBUG "$DBG > \$CONTAINER_EXEC_USER exec -u=postgres $pg_container pg_dump --create $db"
|
||||
$CONTAINER_EXEC_USER exec -u=postgres $pg_container pg_dump --create $db > $dump_dir/$db.sql 2>>$LOG_FILE
|
||||
log $DEBUG "$DBG \$CONTAINER_EXEC_USER -u=postgres $pg_container psql -t -c \"select datname from pg_database where not datistemplate\""
|
||||
for db in $($CONTAINER_EXEC_USER -u=postgres $pg_container psql -t -c "select datname from pg_database where not datistemplate" 2>>$LOG_FILE); do
|
||||
log $DEBUG "$DBG > \$CONTAINER_EXEC_USER -u=postgres $pg_container pg_dump --create $db"
|
||||
$CONTAINER_EXEC_USER -u=postgres $pg_container pg_dump --create $db > $dump_dir/$db.sql 2>>$LOG_FILE
|
||||
is_error $? false && return 1
|
||||
done
|
||||
return 0
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# entrypoint for all actions
|
||||
#
|
||||
|
||||
# 2.111 05.05.2025 - Fix DB-Dump
|
||||
# 2.1.10 05.05.2025 - Postgres-Dump auf podman umgestellt
|
||||
# 2.1.9 02.05.2025 - DB-Dump erweitert, damit Dumps für mehrere postgres möglich sind
|
||||
# 2.1.8 30.04.2025 - systemctl start/stop eingebaut
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
USER_CONTAINERS="homeassistant-pod codeserver jellyfin pgadmin nextcloud-pod calibre nexus git-pod caddy"
|
||||
USER_CONTAINERS="homeassistant-pod codeserver jellyfin pgadmin nextcloud-pod calibre nexus git-pod caddy.socket caddy"
|
||||
ROOT_CONTAINERS=
|
||||
|
||||
DOCKER_ROOT=/var/docker
|
||||
@@ -27,9 +27,9 @@ before_backup() {
|
||||
let local rc=0
|
||||
#dump_mariadb $DOCKER_ROOT/dump/mysql
|
||||
#let rc=rc+$?
|
||||
dump_postgresql postgres $DOCKER_ROOT/dump/postgres
|
||||
dump_postgresql ncd_pg $DOCKER_ROOT/dump/nextcloud
|
||||
let rc=rc+$?
|
||||
dump_postgresql pg_nextcloud $DOCKER_ROOT/dump/pg_nextcloud
|
||||
dump_postgresql gitea_pg $DOCKER_ROOT/dump/gitea
|
||||
let rc=rc+$?
|
||||
if [ $rc -gt 0 ]; then
|
||||
return 1
|
||||
|
||||
Reference in new issue
Block a user