File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8282$ENV {' BASH_ENV' }=' ' ;
8383$ENV {' ENV' }=' ' ;
8484
85+ my $sudo_command = ' ' ;
86+ my $smart_command = undef ;
87+
88+ foreach my $path (@sys_path ) {
89+ $sudo_command = " $path /sudo" if ($sudo_command eq ' ' && -x " $path /sudo" );
90+ $smart_command = " $path /smartctl" if (!defined ($smart_command ) && -x " $path /smartctl" );
91+ last if ($sudo_command ne ' ' && defined ($smart_command ));
92+ }
93+
94+ if (!defined ($smart_command )) {
95+ print " UNKNOWN - Could not find executable smartctl in " . join (" , " , @sys_path ) . " \n " ;
96+ exit $ERRORS {' UNKNOWN' };
97+ }
98+
99+ if ($sudo_command ne ' ' ) {
100+ $smart_command = " $sudo_command $smart_command " ;
101+ }
102+
85103use vars qw( $opt_b $opt_d $opt_g $opt_debug $opt_h $opt_i $opt_e $opt_E $opt_o $opt_r $opt_s $opt_v $opt_w $opt_q $opt_l $opt_skip_sa $opt_skip_temp $opt_skip_load_cycles $opt_skip_error_log $opt_hide_sn) ;
86104Getopt::Long::Configure(' bundling' );
87105GetOptions(
211229 exit $ERRORS {' UNKNOWN' };
212230}
213231
214- my $smart_command = undef ;
215- foreach my $path (@sys_path ) {
216- if (-x " $path /smartctl" ) {
217- $smart_command = " sudo $path /smartctl" ;
218- last ;
219- }
220- }
221-
222- if (!defined ($smart_command )) {
223- print " UNKNOWN - Could not find executable smartctl in " . join (" , " , @sys_path ) . " \n " ;
224- exit $ERRORS {' UNKNOWN' };
225- }
226232
227233my $exit_status = ' OK' ;
228234my $exit_status_local = ' OK' ;
You can’t perform that action at this time.
0 commit comments