open(LOGFILE,">>$log") or die "No se pudo abrir el archivo de log";
seek(LOGFILE,0,2);
print LOGFILE "$commonstring - $logentry\n";
+ $filesize = tell(LOGFILE);
close(LOGFILE);
+ # Chequeo el logsize y su lo supero me quedo con 100 lineas
+ if ($filesize > ($CONFDATA{logsize} * 1024 * 1024))
+ {
+ open(LOGFILE,"+<$log");
+ do ($line = <LOGFILE>) until $. == 100;
+ truncate(LOGFILE,tell(LOGFILE));
+ close(LOGFILE);
+ }
+
if ($consoleout) { print("$logentry\n"); }
}
sub checkUmbrales {
local(*callfields) = $_[0];
my $callsfile = $_[1];
- print("Callfields: @callfields\n");
- print("Callfile: $callsfile\n");
my $matchedUmbral = 0;
my $i = 0;
exit 1;
}
-# Lock file
+# File locking..
+if (is_lock()) { exit 1; }
lock();
# Defino some GLOBALS