[Xastir] Rotating Logs

Chip Griffin n1mie at mac.com
Mon Nov 12 11:12:22 EST 2007


I didn't see the functionality in the existing program or included  
scripts. So I worked on my own. This isn't very sophisticated, my  
Perl is rusty. This requires Perl (I can confirm it works in Perl  
v5.8.6 and 5.8.8) and Logfiles::Rotate (available on CPAN). I wanted  
to do this with a little more automation, but settled for brute  
repetition. Perhaps the next version will be more sophisticated. I  
have mine setup to execute daily with cron and the results are  
emailed to me (email currently broken on one machine, need to work on  
that). Feel free to send any enhancements my way. Feel free to add to  
the distribution.

73,
--de Chip (N1MIE) FN41bn


--- begin perl script ---
#!/usr/bin/perl -w
# written by Chip - n1mie
# version 0.1 11/12/07

use Logfile::Rotate;

eval{
	printf "Rotating tnc.log\n";
	my $log = new Logfile::Rotate( File => '/Users/chip/.xastir/logs/ 
tnc.log', Count => 10);
	$log->rotate();
	undef $log;
	printf "tnc.log rotated\n";
};

eval{
	printf "Rotating net.log\n";
	my $log = new Logfile::Rotate( File => '/Users/chip/.xastir/logs/ 
net.log', Count => 10);
	$log->rotate();
	undef $log;
	printf "net.log rotated\n";
};

eval{
	printf "Rotating message.log\n";
	my $log = new Logfile::Rotate( File => '/Users/chip/.xastir/logs/ 
message.log', Count => 10);
	$log->rotate();
	undef $log;
	printf "message.log rotated\n";
};

eval{
	printf "Rotating wx_alert.log\n";
	my $log = new Logfile::Rotate( File => '/Users/chip/.xastir/logs/ 
wx_alert.log', Count => 10);
	$log->rotate();
	undef $log;
	printf "wx_alert.log rotated\n";
};

if ($@) {
	printf "An error occurred with one of the log files.\n";
	printf $log;
	printf "\n";
	undef $log;
};
--- end perl script ---



More information about the Xastir mailing list