diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl index ffaa63391d..a4a9410ee5 100755 --- a/misc/migration_tools/rebuild_zebra.pl +++ b/misc/migration_tools/rebuild_zebra.pl @@ -254,6 +254,17 @@ my $dbh; # option (wait-for-lock) is provided to let the program wait for the lock. # See https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11078 for details. if ($daemon_mode) { + + $SIG{TERM} = sub { + $dbh->disconnect if $dbh; + exit 0; + }; + + $SIG{INT} = sub { + $dbh->disconnect if $dbh; + exit 0; + }; + while (1) { # For incremental updates, skip the update if the updates are locked diff --git a/t/lib/Mocks/Zebra.pm b/t/lib/Mocks/Zebra.pm index 6c2c184a4f..68808df880 100644 --- a/t/lib/Mocks/Zebra.pm +++ b/t/lib/Mocks/Zebra.pm @@ -274,8 +274,8 @@ Missing POD for cleanup. sub cleanup { my ($self) = @_; - kill 9, $self->{zebra_pid} if defined $self->{zebra_pid}; - kill 9, $self->{indexer_pid} if defined $self->{indexer_pid}; + kill 15, $self->{zebra_pid} if defined $self->{zebra_pid}; + kill 15, $self->{indexer_pid} if defined $self->{indexer_pid}; # Clean up the Zebra files since the child process was just shot rmtree $self->{datadir};