diff options
| author | Jari Matilainen | 2016-01-31 01:51:39 +0100 | 
|---|---|---|
| committer | Jari Matilainen | 2016-01-31 01:51:39 +0100 | 
| commit | b9dd0b0ea739248b69f65d248d66cc4adb76fe1b (patch) | |
| tree | 4a59db8f8512f939132372319a61aeaf50d33f2e | |
| parent | 1d85c4160eb53dfe2293dbc09926679d9b9d4b19 (diff) | |
| download | scripts.irssi.org-b9dd0b0ea739248b69f65d248d66cc4adb76fe1b.tar.bz2 | |
updated logcompress to use core perl module for compression instead of using /exec
| -rw-r--r-- | scripts/logcompress_perl.pl | 23 | 
1 files changed, 23 insertions, 0 deletions
| diff --git a/scripts/logcompress_perl.pl b/scripts/logcompress_perl.pl new file mode 100644 index 0000000..062331e --- /dev/null +++ b/scripts/logcompress_perl.pl @@ -0,0 +1,23 @@ +use strict; +use warnings; +use Irssi; +use IO::Compress::Gzip qw(gzip $GzipError); +use vars qw($VERSION %IRSSI); + +$VERSION = "0.01"; +%IRSSI = ( +    authors	=> 'vague', +    contact	=> 'vague!#irssi@fgreenode', +    name	=> "logcompress_perl", +    description	=> "compress logfiles then they're rotated, modified from original logcompress.pl to use perl modules instead", +    license	=> "Public Domain", +    url		=> "http://irssi.org/", +    changed	=> "2016-01-31T01:45+0100" +); + +sub sig_rotate { +    my $input = $_[0]->{real_fname}; +    gzip $input => "$input.gz" or Irssi::print(MSGLEVEL_CLIENTERROR, "gzip failed: $GzipError\n"); +} + +Irssi::signal_add('log rotated', 'sig_rotate'); | 
