diff --git a/bashrc_add b/bashrc_add index a53a366..5f403f3 100755 --- a/bashrc_add +++ b/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 - else - logwarn "not reachable" - return 1 + 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 "sync-intervall not reached" + return 2 fi else logwarn "no sync allowed from config" >&2 - return 0 + return 1 fi }