mirror of
https://github.com/librenms/librenms-agent.git
synced 2024-05-09 09:54:52 +00:00
if cache older than 360 seconds, don't use it
This commit is contained in:
@ -45,7 +45,12 @@ getopts('u', \%opts);
|
||||
my $noWrite=0;
|
||||
|
||||
if ( ! defined( $opts{u} ) ){
|
||||
if ( -f $cache ){
|
||||
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
|
||||
$atime,$mtime,$ctime,$blksize,$blocks) = stat($cache);
|
||||
my $age=time-$mtime;
|
||||
|
||||
|
||||
if (( -f $cache )&&( $age < 360 )){
|
||||
my $old='';
|
||||
open(my $readfh, "<", $cache) or die "Can't open '".$cache."'";
|
||||
# if this is over 2048, something is most likely wrong
|
||||
@ -55,7 +60,6 @@ if ( ! defined( $opts{u} ) ){
|
||||
}else{
|
||||
$opts{u}=1;
|
||||
$noWrite=1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user