Backup all PostgreSQL clusters or even all database engines

Please consider modification of PostgreSQL backup script to backup all clusters of PostgreSQL. My experience is that many servers are running multiple PostgreSQL instances. Maybe it would even make sense to detect all available databases (Firebird, MySQL, PostgreSQL, MSSQL, OpenLDAP) and backup all of them. If you are interested I can help you to create scripts for all these databases on Linux.

Something like the script below with some extras (like checking if the backup was successful) could do the job.

#!/bin/sh
tmp=/tmp/urbackup_databases
mkdir -p $tmp
chmod 777 $tmp

# Backup all PostgreSQL clusters to binary compressed dumps
if command -v pg_lsclusters>/dev/null; then
  for port in `pg_lsclusters --no-header | awk '{ print $3 }'`; do
    for database in `su postgres -l -c "psql -p $port -A -q -t -c 'SELECT datname FROM pg_database;'"`; do
      if [ "$database" = "postgres" ] || [ "$database" = "template0" ] || [ "$database" = "template1" ]; then continue; fi
      nice -n 19 su postgres -l -c "pg_dump -p $port -Fc $database > ${tmp}/pg_${port}_${database}.dump"
    done
  done
fi

# Backup LDAP
if command -v slapcat>/dev/null; then 
  slapcat -l $tmp/ldap.ldif
fi

Sure see here as an example to backup multiple databases which I recently lifted from the forums: https://github.com/uroni/urbackup_backend/commit/e3d4f6269c5e7355adb6ff23f735137156fee396

And an LDAP (or other kind of databases) dump backup script would be welcome as well.

That autodetection should go into /list as well (or sourced there). On Windows it does auto-backup MSSQL with VSS, though and idk if that was the correct decision (caused some confusion)