fixing gpg environment problem
authorChristian Arnold <arnold@schlittermann.de>
Wed, 22 Dec 2010 13:42:49 +0100
changeset 3 211e08d0d2b8
parent 2 ded3b78c61b1
child 4 67e8bd9a87c5
fixing gpg environment problem
check_exec.pl
--- a/check_exec.pl	Wed Dec 22 08:52:31 2010 +0100
+++ b/check_exec.pl	Wed Dec 22 13:42:49 2010 +0100
@@ -34,6 +34,8 @@
 my $opt_path   = "/var/tmp/nagios";
 my $opt_binary = "/usr/bin/gpg";
 
+my $home_dir = (getpwuid($>))[7];
+
 MAIN: {
     Getopt::Long::Configure('bundling');
     GetOptions(
@@ -66,7 +68,7 @@
 
     my @cmd = ($run_file);
 
-	exec(@cmd) or print "EXEC CRITICAL: Couldn't exec $run_file ($!)";
+    exec(@cmd) or print "EXEC CRITICAL: Couldn't exec $run_file ($!)";
 }
 
 sub cleanup($) {
@@ -120,8 +122,8 @@
     my $dir      = dirname($file);
     my $run_file = fileparse($file, qw/\.[^.]*/);
 
-    my $vc = qq{$opt_binary --verify};
-    my $dc = qq{$opt_binary --batch --yes};
+    my $vc = qq{$opt_binary --homedir $home_dir/.gnupg --verify};
+    my $dc = qq{$opt_binary --homedir $home_dir/.gnupg --batch --yes};
 
     my @r = qx/$vc $file 2>&1/;
     if ($?) {