Re: [HACKERS] pg_basebackup --progress output for batch execution

Поиск
Список
Период
Сортировка
От Arthur Zakirov
Тема Re: [HACKERS] pg_basebackup --progress output for batch execution
Дата
Msg-id 20171114092546.GA22221@zakirov.localdomain
обсуждение исходный текст
Ответ на Re: [HACKERS] pg_basebackup --progress output for batch execution  (Martín Marqués <martin@2ndquadrant.com>)
Ответы Re: [HACKERS] pg_basebackup --progress output for batch execution
Список pgsql-hackers
On Fri, Nov 10, 2017 at 10:32:23AM -0300, Martín Marqués wrote:
> An example where using isatty() might fail is if you run pg_basebackup
> from a tty but redirect the output to a file, I believe that in that
> case isatty() will return true, but it's very likely that the user
> might want batch mode output.

Sorry if I misunderstood you. I think this can happen if you redirect only standard output (stdout) to a file.
But pg_basebackup writes messages to stderr. So you need redirect stderr too:

pg_basebackup -D data -X stream -R --progress --verbose &> backup

or

pg_basebackup -D data_repl -X stream -R --progress --verbose > backup 2>&1

If you redirect stderr too then isatty() will know that message output is not tty.

-- 
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [PATCH]pg_buffercache add a buffer state column, Add fuction todecode buffer state
Следующее
От: "Moon Insung"
Дата:
Сообщение: RE: [HACKERS][PATCH]pg_buffercache add a buffer state column, Add fuction to decode buffer state