From 4f06bb54b51e54ed2612a32258eb918cc70a3b23 Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@tetras-libre.fr> Date: Fri, 28 Sep 2018 14:46:21 +0200 Subject: [PATCH] Fix registry clean --- registry/scripts/clean.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/registry/scripts/clean.sh b/registry/scripts/clean.sh index a3993cd..151302a 100755 --- a/registry/scripts/clean.sh +++ b/registry/scripts/clean.sh @@ -20,9 +20,10 @@ conf_dir="/etc/registry" conf_file="$conf_dir/hosts" while read line do - if [ "$(echo $line | cut -d ' ' -f 1)" -gt "$(date -d '-6 month' +%Y%m%d)" ] + if [ ! -z "$line"] && \ + [ "$(echo $line | cut -d ' ' -f 1)" -lt "$(date -d '-6 month' +%Y%m%d)" ] then - LINES="$LINES\n$(date +%Y%m%d) $(echo $line | cut -d ' ' -f 2-)" + LINES="$LINES\n$line" fi done < $conf_file echo -e $LINES > $conf_file -- GitLab