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 () {
|
||||
# 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
|
||||
logwarn "check if reachable"
|
||||
if $( timeout --foreground "${MSC_GIT_TIMEOUT-$MSC_GIT_TIMEOUT_DEFAULT}" $SGIT ls-remote >/dev/null 2>&1) ;then
|
||||
logwarn "reachable"
|
||||
return 0
|
||||
logwarn "check if reachable"
|
||||
if $( timeout --foreground "${MSC_GIT_TIMEOUT-$MSC_GIT_TIMEOUT_DEFAULT}" $SGIT ls-remote >/dev/null 2>&1) ;then
|
||||
logwarn "reachable"
|
||||
return 0
|
||||
else
|
||||
logwarn "not reachable"
|
||||
return 3
|
||||
fi
|
||||
else
|
||||
logwarn "not reachable"
|
||||
return 1
|
||||
logwarn "sync-intervall not reached"
|
||||
return 2
|
||||
fi
|
||||
else
|
||||
logwarn "no sync allowed from config" >&2
|
||||
return 0
|
||||
return 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue