fix ckrepo
This commit is contained in:
parent
2c2222557a
commit
cfe2f8bfaa
1 changed files with 15 additions and 9 deletions
12
bashrc_add
12
bashrc_add
|
@ -85,7 +85,9 @@ 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
|
||||||
|
@ -93,11 +95,15 @@ EOF
|
||||||
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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue