From 5104962fbe1d9c9b602cdd4e4d9fb4d19f4f9b8c Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 9 Sep 2015 23:32:41 +0200 Subject: Exit with return value 0 when receiving a TERM signal. --- interimap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'interimap') diff --git a/interimap b/interimap index c5de2ce..2c72d56 100755 --- a/interimap +++ b/interimap @@ -118,8 +118,8 @@ sub cleanup() { close $LOGGER_FD if defined $LOGGER_FD; $DBH->disconnect() if defined $DBH; } -$SIG{$_} = sub { msg(undef, $!); cleanup(); exit 1; } foreach qw/INT TERM/; -$SIG{$_} = sub { msg(undef, $!); cleanup(); exit 0; } foreach qw/HUP/; +$SIG{$_} = sub { msg(undef, $!); cleanup(); exit 1; } foreach qw/INT/; +$SIG{$_} = sub { cleanup(); exit 0; } foreach qw/HUP TERM/; ############################################################################# -- cgit v1.2.3 From ea086d30d021f7c018e4d307223162cf051de336 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 10 Sep 2015 20:39:50 +0200 Subject: Print IMAP traffic stats when receiving a SIGHUP. --- interimap | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'interimap') diff --git a/interimap b/interimap index 2c72d56..4a8bde4 100755 --- a/interimap +++ b/interimap @@ -118,8 +118,9 @@ sub cleanup() { close $LOGGER_FD if defined $LOGGER_FD; $DBH->disconnect() if defined $DBH; } -$SIG{$_} = sub { msg(undef, $!); cleanup(); exit 1; } foreach qw/INT/; -$SIG{$_} = sub { cleanup(); exit 0; } foreach qw/HUP TERM/; +$SIG{INT} = sub { msg(undef, $!); cleanup(); exit 1; }; +$SIG{TERM} = sub { cleanup(); exit 0; }; +$SIG{HUP} = sub { $_->stats() foreach grep defined, ($lIMAP, $rIMAP); }; ############################################################################# -- cgit v1.2.3