[icinga-checkins] icinga.org: icinga-core/fholzer/core: Allow providing dbname via commandline parameter

git at icinga.org git at icinga.org
Fri Apr 20 20:42:05 CEST 2012


Module: icinga-core
Branch: fholzer/core
Commit: 38fa0c7fabb93411f4b26ae835a2feca1ce7e8c4
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=38fa0c7fabb93411f4b26ae835a2feca1ce7e8c4

Author: Alexander Wirt <formorer at grml.org>
Date:   Fri Apr 20 16:16:05 2012 +0200

Allow providing dbname via commandline parameter

Getopt::Long is in the core distribution for ages

---

 tools/icinga_verification.pl |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/icinga_verification.pl b/tools/icinga_verification.pl
index 5381266..f065abe 100644
--- a/tools/icinga_verification.pl
+++ b/tools/icinga_verification.pl
@@ -27,6 +27,15 @@ use warnings;
 use DBI;
 use Term::ANSIColor;
 use Env qw (LANG);
+use Getopt::Long;
+
+################################
+# Option parsing
+################################
+
+my $mysqldb = "icinga";
+
+my $result = GetOptions ("icingadb=s" => \$mysqldb);
 
 ################################
 # Script Config
@@ -41,13 +50,12 @@ if( $oscheck eq 'MSWin32' ){
 
 # MySQL Config if MySQL is used
 my $mysqlcheck = qx(which mysql);
-my ( $mysqldb, $mysqlserver, $mysqluser, $mysqlpw ) = '';
+my ( $mysqlserver, $mysqluser, $mysqlpw ) = '';
 
 if (!$mysqlcheck ){
 	print "no Mysql Server Found, skip Config\n";
 } else {
 
-	$mysqldb = "icinga";
 	print "\nMysql Found! - start Config Script\n";
 	print "Values in '< >' are standarts! Confirm with [Enter]\n";
 	print "\nEnter your MYSQL Server <localhost>: ";





More information about the icinga-checkins mailing list