Create a file with the list of disks to test

This commit is contained in:
Jeremy Gardais 2020-02-28 09:56:36 +01:00
parent c954b608b6
commit ddd9191af9
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 9 additions and 3 deletions

View File

@ -13,6 +13,7 @@ use Data::Dumper;
my $bb = new Hobbit('smart');
my $temp_disk_list = "/tmp/smart.drivedb.list";
my @disks = ();
my %olderr = {};
@ -21,9 +22,14 @@ my $CACHEFILE = "$ENV{'XYMONTMP'}/$ENV{'MACHINEDOTS'}.smart.cache";
&load_config("$ENV{'XYMONTMP'}/logfetch.$ENV{'MACHINEDOTS'}.cfg");
# Create a file with the list of disks
system("ls -1 /dev/sd* > /tmp/smart.drivedb.list") == 0
if (-e $temp_disk_list) {
# Should use the existing file
}
else {
# Create a file with the list of disks
system("ls -1 /dev/sd* | grep -vE '[0-9]' > /tmp/smart.drivedb.list") == 0
or die "system command to create smart.drivedb.list failed: $?";
}
# fallback to disk detection if nothing defined in the config
unless (@disks) {