linux – 为什么这个发球台输掉了stdout?
发布时间:2020-12-13 16:54:41 所属栏目:Linux 来源:网络整理
导读:简单的脚本: #!/bin/bashremote_ssh_account="depesz@localhost"directory_to_tar=pgdataexec nice tar cf - "$directory_to_tar" | tee ( md5sum - | ssh "$remote_ssh_account" 'cat - /tmp/h3po4-MD5-2012-03-13.tar' ) | ssh "$remote_ssh_accoun
简单的脚本:
#!/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' 从理论上讲,它应该将数据和校验和传递给远程机器. 但不知何故,发球台失败了: tee: standard output: Resource temporarily unavailable 做了什么,但没有任何结果.我看到两个ssh都开始了,并且tee写了两个,但只有管道到(md5sum | ssh)获取数据 – ssh“data”的strace没有得到任何数据,5秒后tee显示错误. 除此之外所有的作品.建立了2个连接,tar工作,md5sum及其交付工作. 解决方法
试试这个,做一个破坏管道的另一种方法:
#!/bin/bash remote_ssh_account="depesz@localhost" directory_to_tar=pgdata nice tar cf - "$directory_to_tar" | tee >( md5sum | ssh "$remote_ssh_account" 'cat > /tmp/h3po4-MD5-2012-03-13.sum' ) > >( ssh "$remote_ssh_account" 'cat > /tmp/h3po4-data-2012-03-13.tar' ) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |