From: hyokeun Date: Mon, 18 Sep 2017 04:01:35 +0000 (+0900) Subject: TPE-333 logs-collector: Handle all log files X-Git-Tag: submit/trunk/20190927.012743~286^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c2cf9d70d88e896fc540b3291828a66be11c152f;p=services%2Fjenkins-scripts.git TPE-333 logs-collector: Handle all log files 1) -mtime option is not safe to use to filter out files. 2) Fix regex. Change-Id: I18d26cac7ac86663a2746fbe44d79222c9b04e7c --- diff --git a/logs-collector.sh b/logs-collector.sh index 3fd3555..0eb36bb 100755 --- a/logs-collector.sh +++ b/logs-collector.sh @@ -13,12 +13,13 @@ max_age="" [ -d $collectdir ] && max_age=$max_age_def mkdir -p $collectdir # list logs older than 24h, to avoid new live files -logfiles=`find $jhome/jobs -type f $min_age $max_age -name log` +#logfiles=`find $jhome/jobs -type f $min_age $max_age -name log` +logfiles=`find $jhome/jobs -type f -name log` for logfile in $logfiles; do jobdir=`echo $logfile | sed 's/\/log$//'` shortname=`echo $jobdir | sed 's/^\/var\/lib\/jenkins\/jobs\///; s/configurations\/axis-label\///; s/\/builds\//\//; s/\//-/g'` # already existing stored log happens often, so check it first - [ -f $collectdir/$shortname.*.log.xz ] && continue + [ -f $collectdir/$shortname.*log.xz ] && continue # job dir gone away (by jenkins) may happen, but not often, so check it next [ ! -d $jobdir ] && continue jobid=`basename $jobdir`