diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog
index 147dfca0ca..e6083fdeb2 100644
--- a/pandora_server/ChangeLog
+++ b/pandora_server/ChangeLog
@@ -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>
 
 	* pandora_server_installer: Refactord implementation, added
diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server
index 316e9ca69c..79b18c6fb0 100755
--- a/pandora_server/bin/pandora_server
+++ b/pandora_server/bin/pandora_server
@@ -47,11 +47,22 @@ my %Config :shared;
 my @Servers;
 my $DBH;
 my $RUN :shared = 1;
+my $MainThread = threads->self;
 
 ########################################################################################
 # Server shutdown. Handler to do a controlled 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);
 	
 	# Stop servers