rwthomas wrote:
Yes, I understand that a service runs a script. With memcached 1.2.2,
you could specify the logfile in the startup script (memcached-start)
in the /usr/local/bin dir. The new version of memcached does not use
memcached-start. I have tried to add redirects to the start script,
but the only thing it puts in the file that I am redirecting to is the
OK that comes when you start or stop the service. the memcached-start
file is actually a perl script. Below is an example of what we used
to run:
#my $fd_reopened = "/dev/null";
my $fd_reopened = "/root/mem.log";
sub handle_logfile {
# my ($logfile) = @_;
my ($logfile) = "/root/mem.log";
$fd_reopened = $logfile;
}
sub reopen_logfile {
# my ($logfile) = @_;
my ($logfile) = "/root/mem.log";
open *STDERR, ">>$logfile";
open *STDOUT, ">>$logfile";
# open *STDIN, ">>/dev/null";
open *STDIN, ">>$logfile";
$fd_reopened = $logfile;
as you can see, we redirected to mem.log. When we upgraded, we found
that memcached 1.2.8 does not use the memcached-start perl script.
that is why I am trying to find a way to do this again.
We are running CentOs 5.2 with memcached 1.2.8
Centos inherits the RedHat style init scripts which typically use the
daemon() function in /etc/rc.d/init.d/functions to start programs - and
it redirects stdout and stderr to /dev/null among other things. You'll
probably have to make the /etc/init.d/memcached script do the same
things directly instead of using daemon() so you can control the
redirection yourself. It would be a little handier for this style of
control if memcached had a command line option like '-o logfile' so it
could be controlled in the options the script sources from
/etc/sysconfig/memcached and expands on the command line.
--
Les Mikesell
lesmikes...@gmail.com