1. ai postgresql
  2. systemctl status postgresql
  3. /etc/postgresql/15/main/pg_hba.conf

psql

  1. LANG=C
  2. psql -U postgres -c "SELECT datname FROM pg_catalog.pg_database;"
  3. psql -U postgres -c "DROP DATABASE DBNAME;"
  4. psql -U postgres -c "SELECT * FROM pg_catalog.pg_user;"
  1. ai autopostgresqlbackup
  2. dpkg -L autopostgresqlbackup
  3. mkdir /var/backups/autopostgresqlbackup
  4. vim /etc/default/autopostgresqlbackup
  5. /usr/sbin/autopostgresqlbackup
  6. l /var/backups/autopostgresqlbackup/*/*

PeerTube

  1. https://docs.joinpeertube.org/maintain/migration 
  2. vim $(which autopostgresqlbackup) +361 #367
    • su $SU_USERNAME -l -c "pg_dump -Fc $PGHOST $OPT $db -f $2"
    • pg_dump -Fc --username=$USERNAME $PGHOST $OPT $db -f $2
#!/bin/bash
# =============================================================================
# Script Name: docker_pgsql_backup.sh
# Version: 1.0
# Author: Andreas Fleckl
# Description: This script performs backups of PostgreSQL databases running in 
#              Docker containers.
  1. systemctl stop postgresql
  2. rm -rf /var/lib/postgresql/15/main/
  3. sudo -u postgres /usr/lib/postgresql/15/bin/initdb -D /var/lib/postgresql/15/main/
  4. systemctl start postgresql
Tags