Merge branch '205-anadida-ruta-en-appdata-local-temp-por-defecto-para-windows-en-plugin-grep_log' into 'develop'

Resolve "Añadida ruta en Appdata/Local/TEMP por defecto para windows en plugin grep_log"

See merge request artica/pandorafms!2187
This commit is contained in:
Alejandro Fraguas 2019-06-11 10:53:42 +02:00
commit 3c698abcad
2 changed files with 7 additions and 7 deletions

View File

@ -6,17 +6,17 @@
# #
# grep_log Perl script to search log files for a matching pattern. The last # grep_log Perl script to search log files for a matching pattern. The last
# searched position is saved in an index file so that consecutive # searched position is saved in an index file so that consecutive
# runs do not return the same results. The log file inode number is # runs do not return the same results. The log file inode number is
# also saved to detect log rotation. # also saved to detect log rotation.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. # the Free Software Foundation; version 2 of the License.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
############################################################################### ###############################################################################
use strict; use strict;
@ -30,7 +30,7 @@ my $Output = 'module';
my $Verbose = 0; my $Verbose = 0;
# Index file storage directory, with a trailing '/' # Index file storage directory, with a trailing '/'
my $Idx_dir=($^O =~ /win/i)?'.\\':'/tmp/'; my $Idx_dir=($^O =~ /win/i)?"$ENV{'TMP'}\\":"/tmp/";
# Log file # Log file
my $Log_file = ''; my $Log_file = '';
@ -64,7 +64,7 @@ if ( (defined ($ENV{GREP_LOG_TMP})) && (-d $ENV{GREP_LOG_TMP}) ) {
} }
######################################################################################## ########################################################################################
# Erase blank spaces before and after the string # Erase blank spaces before and after the string
######################################################################################## ########################################################################################
sub trim($){ sub trim($){
my $string = shift; my $string = shift;
@ -226,7 +226,7 @@ sub parse_log (;$$) {
open(LOGFILE, $Log_file) || error_msg("Error opening file $Log_file: " . open(LOGFILE, $Log_file) || error_msg("Error opening file $Log_file: " .
$!); $!);
# Go to starting position. # Go to starting position.
seek(LOGFILE, $Idx_pos, 0); seek(LOGFILE, $Idx_pos, 0);
# Parse log file # Parse log file
@ -318,7 +318,7 @@ sub print_log ($) {
print_summary() if ($summary_flag == 1); print_summary() if ($summary_flag == 1);
return; return;
} }
# Log module # Log module
if ($Output eq 'log_module') { if ($Output eq 'log_module') {
my $output = "<log_module>\n"; my $output = "<log_module>\n";