Hi,
Is there a trick somehow to be able to log the output of pg_dump / pg_restore
I have this shell script to start with.
#!/bin/bash
SECONDS=0
START_pgdump=$( date )
pg_dump -v -d abcdb-U abc \
-h abchost \
--if-exists --clean -Fc \
-f abcdumpfile.dmp \
--quote-all-identifiers -n abc | tee -a pg_dump.log 2>pg_dump.err
FINISH_pgdump=$( date )
echo "START_pgdump = ${START_pgdump}"
echo "FINISH_pgdump = ${FINISH_pgdump}"
echo "SECONDS = ${SECONDS}"
SECONDS=0
START_pgdump=$( date )
pg_dump -v -d abcdb-U abc \
-h abchost \
--if-exists --clean -Fc \
-f abcdumpfile.dmp \
--quote-all-identifiers -n abc | tee -a pg_dump.log 2>pg_dump.err
FINISH_pgdump=$( date )
echo "START_pgdump = ${START_pgdump}"
echo "FINISH_pgdump = ${FINISH_pgdump}"
echo "SECONDS = ${SECONDS}"
IF I do
--quote-all-identifiers -n abc 1>pg_dump.log 2>pg_dump.err
I get the output but in the pg_dump.err. I'm confused. Any thoughts?
The main reason for wanting to capture the output is for where there are too many objects to pg_dump and it can be difficult scrolling through the screen to check for errors.