Regenerate disk_list file if too old

This commit is contained in:
Jeremy Gardais 2020-02-28 14:22:32 +01:00
parent a9d76dd030
commit e55b2d990f
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 9 additions and 0 deletions

View File

@ -22,6 +22,15 @@ my $CACHEFILE = "$ENV{'XYMONTMP'}/$ENV{'MACHINEDOTS'}.smart.cache";
&load_config("$ENV{'XYMONTMP'}/logfetch.$ENV{'MACHINEDOTS'}.cfg"); &load_config("$ENV{'XYMONTMP'}/logfetch.$ENV{'MACHINEDOTS'}.cfg");
my @disks_stat = stat($temp_disk_list);
my $disks_mtime = scalar @disks_stat ? $disks_stat[9] : 0;
#
# Regenerate disks list if the file is too old (600 minutes)
if (time() - $disks_mtime > 600)
{
unlink $temp_disk_list;
}
if (-e $temp_disk_list) { if (-e $temp_disk_list) {
# Should use the existing file # Should use the existing file
} }