On Wed, 09 Feb 2011, Jesse Rosenthal wrote: > Michal, > > On Sun, 06 Feb 2011 00:58:29 +0100, Michal Sojka <sojkam1 at fel.cvut.cz> > wrote: > > 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. > > Seemed to work okay for me when I played around with it a bit (in > different circumstances, and with a confused laptop waking up from > hibernation). But I'll hold off on updating it till I can figure out the > most reliable way.
Hi Jesse, I've just found that there is a SSH option called ControlPersist and this is the missing piece to reliable connection sharing for notmuch remote script. This option is available since openssh 5.6 (http://www.openssh.org/txt/release-5.6) with a fix of race conditions in 5.7 (http://www.openssh.org/txt/release-5.7). Now I have in my script the following command: ssh -x -a -oControlMaster=auto -oControlPersist=600 -S $SOCKET $USER@$SSH_HOST $NOTMUCH_REMOTE_BIN ${CMD} ${args} where SOCKET="${CACHE}/.ssh-socket-${USER}@${SSH_HOST}" and it works perfectly. Unfortunately, this option is not supported in recently released Debian Squeeze but from http://bugs.debian.org/594295 seems that it might be supported later, perhaps in a point release. -Michal