#
_git_conn_check=" "
git_conn_check() {
- local dest=$(git config --local --get remote.origin.url | sed 's/:.*\?$//')
+ local dest=$(git config --local --get remote.origin.url | sed -e 's/:.*$//' -e 's/^.*@//')
if [ -z "$dest" ]; then
- logger -t $NAME -s "Can't get git repo from `cwd`"
+ logger -t $NAME -s "Can't get \`git config --het remote.origin.url\` from `cwd`"
return 1
fi
*" $dest=1 "*) ok=1 ;;
*)
ok=0
- timeout 5 ssh -o BatchMode=yes -o ConnectTimeout=5 $dest true && ok=1
+ case "$dest" in
+ *"@"*) timeout 5 ssh -o BatchMode=yes -o ConnectTimeout=5 $dest true && ok=1 ;;
+ *) nc -z -w 5 $dest 22 && ok=1 ;;
+ esac
_git_conn_check="${_git_conn_check}$dest=$ok "
- echo "<$_git_conn_check>"
;;
esac
# Pull
echo ">git pull $repo (user=$user)"
- #git_conn_check || continue
cmd="GIT_SSH=$GIT_SSH cd \"$repo\" && git pull"
- if ! git_conn_check; then
- true
+ if [ 1 = 1 ] && ! git_conn_check; then
+ [ 1 = 1 ]
elif [ "$USER" == "$user" ]; then
bash -c "$cmd"
elif [ "$USER" == "root" ]; then