On Sat, 05 Feb 2011, Michal Sojka wrote: > On Thu, 27 Jan 2011, Jesse Rosenthal wrote: > > A future feature might be to integrate the ControlMaster feature of > > openssh into the script, instead of having to open a connection > > manually, but there are some complications there (dead sockets still > > around if you go offline, etc.). > > In another project I worked around the dead sockets this way: > > sshgw() { > local socket="$HOME/.ssh/cangw-connection" > > if [[ ! -S $socket ]] || ! ssh -x -a -S $socket root@192.168.2.3 true; then > # Create master connection to speed up subsequent commands. > ssh -N -f -M -S $socket root@192.168.2.3 >/dev/null 2>&1 > fi > ssh -x -a -S $socket root@192.168.2.3 "$@" > } Hmm, this code worked well with dropbear ssh server but it seems that with openssh server the result is not that good. Namely, if the master connection is dead, the command running true blocked for a long time. I have always killed it before it timed out so I don't know whether it blocks indefinitely or there is only long timeout. I may look at this later, but I use notmuch remotely only from time to time so this is not priority for me. -Michal