Re: error messages not getting logged when running script from cron
В списке pgsql-general по дате отправления:
| От | John R Pierce |
|---|---|
| Тема | Re: error messages not getting logged when running script from cron |
| Дата | |
| Msg-id | 56537804.2050405@hogranch.com обсуждение исходный текст |
| Ответ на | Re: error messages not getting logged when running script from cron (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | pgsql-general |
On 11/23/2015 12:21 PM, Tom Lane wrote:
>> >0 20 * * * db_backup.sh 1> /dev/null 2>&1 | mail -s "backup cron"
>> >myemail@comp.com
>> >I am re-directing stderr to stdout and then sending that to email.
> Uh, read it again: you're redirecting stdout to /dev/null and then
> redirecting stderr to go where stdout goes. So all output is
> going to the bit bucket, not the pipe.
the 2>&1 notation is not completely intuitive.... if you want to
redirect stderr to the pipe and bitbucket stdout, do it in the opposite
order.
.... 2>&1 1> /dev/null | ...
that sends stderr to the file that stdout was assigned, and sends stdout
to the bit bucket... note specifically that redirecting stdout won't
affect the file stderr is being sent.
--
john r pierce, recycling bits in santa cruz
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера