smeserver-postgresql/root/etc/e-smith/events/actions/pgsql-dump-tables

16 lines
399 B
Bash

#!/bin/sh
status=$(/sbin/e-smith/config getprop postgresql status)
if [ "$status" = "disabled" ]
then
echo "postgresql is disabled - no tables dumped" >&2
exit 0
fi
pgdumpall="/usr/pgsql-13/bin/pg_dumpall"
#avoid error could not change directory to
cd /tmp
umask 027
exec >/home/e-smith/db/pgsql/pgsql.dump
chgrp postgres /home/e-smith/db/pgsql/pgsql.dump
exec chpst -u postgres $pgdumpall