Forum OpenACS Q&A: Re: My production site is down

Collapse
Posted by Don Baccus on
Here's a server log roll script that works from me. There's actually a more general one floating around that I simplified to make this one. It sits in cron.daily and works fine (it's hardwired to one of my server instance names).
#!/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';

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

print "Rolling ", join(" ", @pids), "\n";
kill 'HUP', @pids;
For this to work you have to have the AOLserver parameters "roll server log on SIGHUP" set. You can roll the access lo g from within the AOLserver .tcl config file. Both these are documented in the AOLserver documentation but I agree it would be nice to have something written up in our "set up your world" docs. Just as we've done with my simple backup scripts.

(there's a space after the less-than sign before the PID above that needs to be removed)