Forum OpenACS Q&A: Response to Rolling logs

Collapse
2: Response to Rolling logs (response to 1)
Posted by Don Baccus on
You have to do kick AOLserver with a kill -HUP to get it to roll its log, and it will ignore formating and similar information in the start up file. That only works for the access log, not the server error log. It's easy enough to issue the HUP from a daily cronjob ...

Here's a perl script you can try:

#!/usr/bin/perl

## Sends AOLserver an HUP signal, so it will roll it's logs. Takes as its
## only argument the name of the server to roll.

## modified from the version in ACS 4

$ENV{'PATH'} = '/sbin:/bin';

if (scalar(@ARGV) == 0) {
    die "Don't run this without any arguments!
";
}

my $server = shift;
# untaint this variable to make suidperl happy
$server =~ /^([w-]*)$/;
my $servername = $1;

## get the PIDs of all matching servers
open(PID, "/bin/ps -efwww |") || die $!;
my @pids;
while () {
  next unless /^s*S+s+(d+).*nsd.*/$servername.tcl/;
  my $pid = $1;
  push(@pids, $pid);
}
close PID;

print "Rolling ", join(" ", @pids), "
";
kill 'HUP', @pids;