#!/bin/bash

cd /tmp

test -d /var/lib/pgsql || exit 0

pgrep postgres &>/dev/null || exit 10

tar -jcvf /var/backups/postgres/postgresql-config.tbz2 /var/lib/pgsql/*/data/*.conf 

/usr/sbin/runuser postgres -l -s /bin/bash -c '/usr/bin/pg_dumpall > /var/backups/postgres/pgdump.sql'

