mejora finalizacion de concatenacion

This commit is contained in:
jp.av.dev 2022-05-23 00:53:21 -04:00
parent a373e66d29
commit 72fb322e98
2 changed files with 10 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
sqlite_views/
__pycache__/ __pycache__/
test/ test/
*.db *.db

View File

@ -75,21 +75,24 @@ extrae_logs(){
concat_log(){ concat_log(){
log_tipo="${1}" log_tipo="${1}"
if [[ "$(ls $destino_log/$log_tipo.* 2>/dev/null)" ]]; then if [[ "$(ls $destino_log/$log_tipo.* 2>/dev/null)" ]]; then
printf '%b - Concatenando log %s %b\n' "${GRn}" "${1}" "${RST}" printf '%b - Concatenando log %s %b' "${GRn}" "${1}" "${RST}"
for file in $(\ls -v $destino_log/$log_tipo.*); do for file in $(\ls -v $destino_log/$log_tipo.*); do
cat $file >> $destino_log/$log_tipo cat $file >> $destino_log/$log_tipo
rm -f $file rm -f $file
done done
printf '%b ...OK!%b\n' "${GRn}" "${RST}"
else else
Info 0 "No existen logs [${log_tipo}] para concatenar" Info 0 "No existen logs [${log_tipo}] para concatenar"
fi #2>/dev/null fi
} }
concatena_logs(){ concatena_logs(){
concat_log access.log && log_tipos=(access.log error.log reverse-error.log reverse-access.log)
concat_log error.log && for tipo in ${log_tipos[@]}; do
concat_log reverse-access.log && if [[ "$(ls $destino_log/${tipo}.* 2>/dev/null)" ]]; then
concat_log reverse-error.log concat_log ${tipo}
fi
done
} }
main(){ main(){