#!/bin/bash remote_ssh_account="depesz@localhost" directory_to_tar=pgdata exec nice tar cf - "$directory_to_tar" | \ tee >( md5sum - | \ ssh "$remote_ssh_account" 'cat - > /tmp/h3po4-MD5-2012-03-13.tar' ) | \ ssh "$remote_ssh_account" 'cat - > /tmp/h3po4-data-2012-03-13.tar'
Theoretically it should deliver the data and checksum, to remote machine.
But somehow the tee fails with:
tee: standard output: Resource temporarily unavailable
Did strace, but nothing came out of it. I see both ssh started, and tee writing to both of them, but only the pipe to ( md5sum | ssh ) gets data - strace of the ssh "data" doesn't get any data, and after 5 seconds tee shows the error.
Aside from this all works. 2 connections are established, tar works, md5sum and its delivery works.