Re: more contrib: log rotator

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: "Ed L(dot)" <pgsql(at)bluepolka(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Sullivan <andrew(at)libertyrms(dot)info>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: more contrib: log rotator
Date: 2003-04-04 21:17:41
Message-ID: Pine.LNX.4.33.0304041413540.24822-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 4 Apr 2003, Ed L. wrote:

> On Friday April 4 2003 11:58, Tom Lane wrote:
> > "scott.marlowe" <scott(dot)marlowe(at)ihs(dot)com> writes:
> > > rotatelogs is in my path and all, it just never sees it.
> >
> > You mean the command fails? Or just that it doesn't capture output?
> >
> > > "$po_path" ${1+"$@"} </dev/null | $PGPATH/rotatelogs $logfile $DURATION
> > > 2>&1 &
> >
> > Most if not all of the postmaster's log output goes to stderr, so you'd
> > need
> >
> > "$po_path" ${1+"$@"} </dev/null 2>&1 | $PGPATH/rotatelogs ...
> >
> > to have any hope of useful results.
>
> Hmmm. I would have agreed 2>&1 was needed, too, but this command seems to
> routinely capture all output, including ERRORs:
>
> nohup pg_ctl start | nohup rotatelogs server_log.%a 86400

OK, So I tried putting the 2>&1 before the | and all. No matter what I
try, every from the | on is ignored. ps doesn't show it, and neither does
pg_ctl status. Both show a command line of
/usr/local/pgsql/bin/postmaster as the only input to start the server.

Now, the thing is, I've tried this with hardcoded values, like:

"$po_path" ${1+"$@"} </dev/null 2>&1 /usr/local/pgsql/bin/rotatelogs
/mnt/d1/data/logs/pglog 86400

where I know the logs directory exists. It works if I do:

pg_ctl start | rotatelogs $PGDATA/pglog 86400 2>1&

and puts the log files there.

I've copied rotatelogs into the /usr/local/pgsql/bin directory as well.

So, I'm thinking this is my weakness in shell scripting that's getting me
here, and that the shell is eating the |, not passing it out with the
postmaster to be used when it starts.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ed L. 2003-04-04 21:45:07 Re: more contrib: log rotator
Previous Message Josh Berkus 2003-04-04 20:17:26 Re: [PERFORM] OSS database needed for testing