fix ckrepo

This commit is contained in:
Jakobus Schürz 2020-12-23 13:31:05 +01:00
parent 2c2222557a
commit cfe2f8bfaa

View file

@ -85,19 +85,25 @@ EOF
ckrepo () { ckrepo () {
# check if remote repo is reachable # check if remote repo is reachable
if [ ${MSC_GIT_SYNC-$MSC_GIT_REPO_UPDATE} -a $(stat --printf %Y ${MSC_GIT_UPD_REPO_STATFILE} 2>/dev/null || echo 0 ) \ if ${MSC_GIT_SYNC-$MSC_GIT_REPO_UPDATE}; then
if [ $(stat --printf %Y ${MSC_GIT_UPD_REPO_STATFILE} 2>/dev/null || echo 0 ) \
-lt $(date --date="${MSC_GIT_REPO_UPDATE_INTERVALL-${MSC_GIT_REPO_UPDATE_INTERVALL_DEFAULT}} hours ago" "+%s") ]; then -lt $(date --date="${MSC_GIT_REPO_UPDATE_INTERVALL-${MSC_GIT_REPO_UPDATE_INTERVALL_DEFAULT}} hours ago" "+%s") ]; then
logwarn "check if reachable" logwarn "check if reachable"
if $( timeout --foreground "${MSC_GIT_TIMEOUT-$MSC_GIT_TIMEOUT_DEFAULT}" $SGIT ls-remote >/dev/null 2>&1) ;then if $( timeout --foreground "${MSC_GIT_TIMEOUT-$MSC_GIT_TIMEOUT_DEFAULT}" $SGIT ls-remote >/dev/null 2>&1) ;then
logwarn "reachable" logwarn "reachable"
return 0 return 0
else else
logwarn "not reachable" logwarn "not reachable"
return 1 return 3
fi
else
logwarn "sync-intervall not reached"
return 2
fi fi
else else
logwarn "no sync allowed from config" >&2 logwarn "no sync allowed from config" >&2
return 0 return 1
fi fi
} }