From 9271509e5d2a2ae9cf7bb0c8fbe6336865484591 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Sun, 1 Nov 2009 02:19:14 +0100 Subject: [PATCH] check_interval: More fixes --- daemons/gc.sh | 2 +- daemons/update.sh | 2 +- shlib.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/daemons/gc.sh b/daemons/gc.sh index 61b02fa..5fdee30 100755 --- a/daemons/gc.sh +++ b/daemons/gc.sh @@ -7,7 +7,7 @@ set -e proj="$1" cd "$cfg_reporoot/$proj.git" -if check_interval lastgc $cfg_min_gc_interval; then +if ! check_interval lastgc $cfg_min_gc_interval; then progress "= [$proj] garbage check skip (last at $(config_get lastgc))" exit 0 fi diff --git a/daemons/update.sh b/daemons/update.sh index b44499d..95dc58f 100755 --- a/daemons/update.sh +++ b/daemons/update.sh @@ -7,7 +7,7 @@ set -e proj="$1" cd "$cfg_reporoot/$proj.git" -if check_interval lastrefresh $cfg_min_mirror_interval; then +if ! check_interval lastrefresh $cfg_min_mirror_interval; then progress "= [$proj] update skip (last at $(config_get lastrefresh))" exit 0 fi diff --git a/shlib.sh b/shlib.sh index 2f3dc84..e4271d4 100644 --- a/shlib.sh +++ b/shlib.sh @@ -73,14 +73,14 @@ config_set() { } -# Tool for checking whether at least given number of seconds passed +# Tool for checking whether at least given number of seconds passed (true if so) check_interval() { od="$(config_get "$1")" [ -n "$od" ] || return 1 os="$(date +%s -d "$od")" [ -n "$os" ] || return 1 ns="$(date +%s)" - [ $ns -gt $(($os+$2)) ] + [ $ns -ge $(($os+$2)) ] } -- 2.11.4.GIT