I am trying to write a log file and saw an eaxmple as below. The example forks and I don't need to do. I jsut want to open a log file and try to add into the log file and try with count parameter alone. Or do I have to use
for rotating. Please give me a small example. Thanks.
Code:
Signal
Code:
use Logfile::Rotate;
$logfile = new Logfile::Rotate(
File => "/var/adm/log/syslog",
Count => 5,
Signal =>
sub {
open PID, "/etc/syslog.pid" or
die "Unable to open pid file:$!\n";
chomp($pid = <PID>);
close PID;
# should check validity first
kill 'HUP', $pid;
}
);
Comment