fix ckrepo
This commit is contained in:
parent
2c2222557a
commit
cfe2f8bfaa
1 changed files with 15 additions and 9 deletions
22
bashrc_add
22
bashrc_add
|
@ -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
|
||||||
|
logwarn "not reachable"
|
||||||
|
return 3
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
logwarn "not reachable"
|
logwarn "sync-intervall not reached"
|
||||||
return 1
|
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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue