I have been having issues with various rsync operations over SSH, on a particular machine on our network, failing and giving errors like:
rsync: connection unexpectedly closed (45482 bytes received so far) [generator]
I found a similar post (rsync - unexplained error) for which one of the answers suggested running the SSH command used by rsync in verbose mode and redirecting the output, in my case as follows:
rsync -av -e 'bash -x -c "ssh -p 22 -vvvv $0 $@ 2>/tmp/rsync-ssh.stderr | tee /tmp/rsync.stdout"' --rsync-path='sudo rsync' "backup_user@10.0.0.2:/media/remote_volume/" "/media/local_volume"
This rsync command seems to run fine for a while but eventually fails with the error:
tee: standard output: Resource temporarily unavailable
I am guessing it is likely failing for a similar reason as is described in the answer to the following question: Why is this tee losing stdout? However, it doesn't seem clear to me how I should change the SSH command in my case to remidy the issue.
Does anyone know way of making SSH play nice with tee in this scenario?