From 262655516ef32411114083955cb7044657a8eb7e Mon Sep 17 00:00:00 2001
From: Ramon Novoa <rnovoa@artica.es>
Date: Tue, 22 Sep 2020 12:17:29 +0200
Subject: [PATCH] pandora_db only runs on the master server.

Ref. pandora_enterprise#6315
---
 pandora_server/util/pandora_db.pl | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index f104b9b097..13752f69a8 100755
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -1069,6 +1069,13 @@ if ($conf{'_history_db_enabled'} eq '1') {
 	}
 }
 
+# Only run on master servers.
+pandora_set_master(\%conf, $dbh);
+if ($conf{'_force'} == 0 && pandora_is_master(\%conf) == 0) { 
+	log_message ('', " [*] Not a master server.\n\n");
+	exit 1;
+}
+
 # Get a lock
 my $lock = db_get_lock ($dbh, 'pandora_db');
 if ($lock == 0 && $conf{'_force'} == 0) {