From 295b94102dc5a3ab16720e8b8d4d4b902f0bb093 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Tue, 2 Nov 2021 15:58:30 +0100 Subject: [PATCH] add deletion of logs --- deploy_app.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deploy_app.sh b/deploy_app.sh index e0eff40..ce27b53 100755 --- a/deploy_app.sh +++ b/deploy_app.sh @@ -263,10 +263,11 @@ function deploy(){ function logdelete(){ local sProfile=$1 + header "DELETE LOGS ${logdir}/${sProfile}__* ... keep $iKeep" # order files by time typeset -i local _iFiles=$( ls -1t ${logdir}/${sProfile}__*.log | wc -l ) typeset -i local _iStart=$iKeep+1 - header "DELETE LOGS ${logdir}/${sProfile}__* ... keep $iKeep" + if [ $_iFiles -gt $iKeep ]; then ls -1t ${logdir}/${sProfile}__*.log | sed -n "${_iStart},${_iFiles}p" | while read mylogfile do -- GitLab