diff options
Diffstat (limited to 'plugins-scripts/check_disk_smb.pl')
-rwxr-xr-x | plugins-scripts/check_disk_smb.pl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl index 4805434f..28c49e84 100755 --- a/plugins-scripts/check_disk_smb.pl +++ b/plugins-scripts/check_disk_smb.pl | |||
@@ -19,16 +19,18 @@ | |||
19 | # | 19 | # |
20 | 20 | ||
21 | require 5.004; | 21 | require 5.004; |
22 | use POSIX; | 22 | use POSIX qw(setsid); |
23 | use strict; | 23 | use strict; |
24 | use Getopt::Long; | 24 | use Getopt::Long; |
25 | use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $opt_a $verbose); | 25 | use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $opt_a $verbose); |
26 | use vars qw($PROGNAME); | 26 | use vars qw($PROGNAME); |
27 | use FindBin; | 27 | use FindBin; |
28 | use lib "$FindBin::Bin"; | 28 | use lib "$FindBin::Bin"; |
29 | use lib '@libexecdir@'; | ||
30 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); | 29 | use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); |
31 | 30 | ||
31 | # make us session leader which makes all childs exit if we do | ||
32 | setsid; | ||
33 | |||
32 | sub print_help (); | 34 | sub print_help (); |
33 | sub print_usage (); | 35 | sub print_usage (); |
34 | 36 | ||
@@ -55,10 +57,10 @@ GetOptions | |||
55 | 57 | ||
56 | if ($opt_V) { | 58 | if ($opt_V) { |
57 | print_revision($PROGNAME,'@NP_VERSION@'); #' | 59 | print_revision($PROGNAME,'@NP_VERSION@'); #' |
58 | exit $ERRORS{'OK'}; | 60 | exit $ERRORS{'UNKNOWN'}; |
59 | } | 61 | } |
60 | 62 | ||
61 | if ($opt_h) {print_help(); exit $ERRORS{'OK'};} | 63 | if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};} |
62 | 64 | ||
63 | my $smbclient = $utils::PATH_TO_SMBCLIENT; | 65 | my $smbclient = $utils::PATH_TO_SMBCLIENT; |
64 | $smbclient || usage("check requires smbclient, smbclient not set\n"); | 66 | $smbclient || usage("check requires smbclient, smbclient not set\n"); |
@@ -176,6 +178,8 @@ my @lines = undef; | |||
176 | # Just in case of problems, let's not hang the monitoring system | 178 | # Just in case of problems, let's not hang the monitoring system |
177 | $SIG{'ALRM'} = sub { | 179 | $SIG{'ALRM'} = sub { |
178 | print "No Answer from Client\n"; | 180 | print "No Answer from Client\n"; |
181 | $SIG{'INT'} = 'IGNORE'; | ||
182 | kill(-2, $$); | ||
179 | exit $ERRORS{"UNKNOWN"}; | 183 | exit $ERRORS{"UNKNOWN"}; |
180 | }; | 184 | }; |
181 | alarm($TIMEOUT); | 185 | alarm($TIMEOUT); |