X-Git-Url: https://git.llucax.com/z.facultad/75.08/llamadas.git/blobdiff_plain/fbda2151a8f5f6e2e7fdf5b1d63a38b57fbac262..c73e52eb8d8b3798ac447fc5a851140a7472ed6c:/inst/antifraude.pl diff --git a/inst/antifraude.pl b/inst/antifraude.pl index 47ffc42..cdb843d 100644 --- a/inst/antifraude.pl +++ b/inst/antifraude.pl @@ -82,8 +82,18 @@ sub logEntry { 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 = ) until $. == 100; + truncate(LOGFILE,tell(LOGFILE)); + close(LOGFILE); + } + if ($consoleout) { print("$logentry\n"); } } @@ -98,8 +108,6 @@ sub badCall { sub checkUmbrales { local(*callfields) = $_[0]; my $callsfile = $_[1]; - print("Callfields: @callfields\n"); - print("Callfile: $callsfile\n"); my $matchedUmbral = 0; my $i = 0; @@ -155,7 +163,8 @@ if ((!$ARGV[0]) || (! -d $ARGV[0])) { exit 1; } -# Lock file +# File locking.. +if (is_lock()) { exit 1; } lock(); # Defino some GLOBALS