Requirements: The company has two backup servers, one from the beginning, every night from the server began to synchronize some data on the main service, but rsync always disconnected, tried a lot of methods are useless, wrote a script to solve this problem, as follows
#!/bin/bashrsync-avzp--timeout=60-e "Ssh-p X" x.x.x.x:/kejiandata/streams/tarena/streams/*/hzdata/streams/while (( 1 <));d o ps aux | grep/kejiandata/streams/tarena/| grep rsync | grep timeout If [' echo $? '-eq 1];then rsync-avzp--timeout=60-e "Ssh-p X" X.x.x.x:/kejiandata/streams/tare na/streams/*/hzdata/streams/fi Sleep If [' Date + '%h%m '-ge 0830];then exit Fidone
This article is from the "Court of the Odd Tree" blog, please be sure to keep this source http://zhangdl.blog.51cto.com/11050780/1866710
Shell instance: Temporarily resolves an issue with rsync auto-disconnection