2014-08-12 Koichiro Kikuchi <koichiro@rworks.jp>

* bin/pandora_server: Fixed issue that pandora_server failed to
	 shut down properly on non-Linux systems.

	Merged r10335 from branch 5.0.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10402 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
koichirok 2014-08-12 06:18:57 +00:00
parent 78d80911f5
commit 9f2dca728e
2 changed files with 18 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2014-08-12 Koichiro Kikuchi <koichiro@rworks.jp>
* bin/pandora_server: Fixed issue that pandora_server failed to
shut down properly on non-Linux systems.
Merged r10335 from branch 5.0.
2014-08-12 Koichiro Kikuchi <koichiro@rworks.jp> 2014-08-12 Koichiro Kikuchi <koichiro@rworks.jp>
* pandora_server_installer: Refactord implementation, added * pandora_server_installer: Refactord implementation, added

View File

@ -47,11 +47,22 @@ my %Config :shared;
my @Servers; my @Servers;
my $DBH; my $DBH;
my $RUN :shared = 1; my $RUN :shared = 1;
my $MainThread = threads->self;
######################################################################################## ########################################################################################
# Server shutdown. Handler to do a controlled shutdown. # Server shutdown. Handler to do a controlled shutdown.
######################################################################################## ########################################################################################
sub pandora_shutdown () { sub pandora_shutdown () {
my $signal = shift;
logger (\%Config, 'Pandora FMS Server \'' . $Config{'servername'} . '\' Caught SIG' . $signal . ' by thread(' . threads->self()->tid() . ')', 10);
if (!threads->self->equal($MainThread)) {
# deliver signal to the main thread since no other threads than main thread
# could disconnet $DBH properly
$MainThread->kill($signal);
return;
}
logger (\%Config, 'Pandora FMS Server \'' . $Config{'servername'} . '\' Shutdown by signal ', 1); logger (\%Config, 'Pandora FMS Server \'' . $Config{'servername'} . '\' Shutdown by signal ', 1);
# Stop servers # Stop servers