change variable-name and logging

This commit is contained in:
Jakobus Schürz 2022-10-21 10:50:39 +02:00
parent df804c318b
commit 9f2be86152

View file

@ -49,7 +49,7 @@ if [[ $- = *i* ]] ; then
[ -z "${MSC_GIT_SYNC+x}" ] && export MSC_GIT_SYNC=true
# hardcoded git
export SGIT="git -C ${MSC_BASE}"
export MSC_GIT="git -C ${MSC_BASE}"
@ -94,15 +94,15 @@ EOF
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
logwarning "sync-intervall (${MSC_GIT_REPO_UPDATE_INTERVALL-${MSC_GIT_REPO_UPDATE_INTERVALL_DEFAULT}} hours) reached"
logwarning "check if reachable"
loginfo "check if remote »$($MSC_GIT rev-parse --abbrev-ref @{u} 2>/dev/null | cut -d'/' -f1)« is reachable"
# git ls-remote
# 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}" $MSC_GIT ls-remote >/dev/null 2>&1) ;then
# git fetch --dry-run --verbose
if $( timeout --foreground "${MSC_GIT_TIMEOUT-$MSC_GIT_TIMEOUT_DEFAULT}" $SGIT fetch --dry-run >/dev/null 2>&1) ;then
logwarning "reachable"
if $MSC_GIT fetch --dry-run >/dev/null 2>&1 ;then
loginfo "reachable"
return 0
else
logwarning "not reachable"
logwarning "$($MSC_GIT rev-parse --abbrev-ref @{u} 2>/dev/null | cut -d'/' -f1) not reachable"
return 3
fi
else