I need to start a postgres daemon and redirrect it's STDERR and STDOUT to a logfile rotator (can't mix them). Here's a sketch of what I'm thinking:
What I'm wondering is about efficiency. Is there a better way to do this? I'd very much like to exec the final call to the postmaster daemon so that I don't have the overhead of a perl instance. Is is possible to detach these processes? Should I be writing this in shell?use IPC::Open3; our $rotatelogs_bin = ''; our $rotate_size = '10M'; # must end with M, see rotatelogs docs our $logdir = '/home/ahammond/logtest/log'; our $pg_bin = '/home/ahammond/logtest/belcher.pl'; our $pg_args = ''; # start by opening stdout and stderr loggers open (STDOUTLOG, "| $rotatelogs_bin $logdir/stdout.log $rotate_size") or die "Can't open stdoutlog: $!\n"; open (STDERRLOG, "| $rotatelogs_bin $logdir/stderr.log $rotate_size") or die "Can't open stderrlog: $!\n"; # filehandle manipulation here? our $pid = open3 (\*STDIN, \*STDOUTLOG, \*STDERRLOG, $pg_bin, $pg_args);
Drew
In reply to efficiently dispatching loggers for daemon by agh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |