Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-13-2015, 11:02 AM   #1
Registered: Jun 2009
Location: Brighton, UK
Posts: 50

Rep: Reputation: 16
rsync non-existent path hangs

I have a list of syncs to perform, but sometimes they are not present on the remote server.
Is there a way to get it to gracefully skip/pass over these?

rsync -a server:/does/not/exist /here

Currently it hangs for ages and then bails out with `ssh: connect to host server port 22: Operation timed out`
Old 11-13-2015, 11:45 AM   #2
Senior Member
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,242
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Are you running a script for this? If so maybe you should check for the the files or directories exist before the command is executed. I'm not a programmer but maybe something like this would work;

if [ -e server:/does/exist ]; then
	 rsync -a server:/does/exist /here
Old 11-13-2015, 01:37 PM   #3
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 410

Rep: Reputation: Disabled
if ssh user@server "[[ -e /path/to/file]]" ; then
  do something
  do something else
You will need ssh keys for this to work in a script else you will be prompted for password each time it cycles.
Old 11-13-2015, 06:51 PM   #4
Senior Member
Registered: Jul 2012
Location: Aachen, Germany
Distribution: Void, Debian
Posts: 1,014

Rep: Reputation: 306Reputation: 306Reputation: 306Reputation: 306
Originally Posted by IanVaughan View Post
Currently it hangs for ages and then bails out with `ssh: connect to host server port 22: Operation timed out`
This message looks to me like you can't even establish an ssh session. So any ssh command you'll run to check existance of remote directories will be slow to timeout just the same way.
Skipping over remote servers that are not available with a very small delay leads to the risk of having false positives... i.e. skipping over servers that actually are available and are just responding slowly. That's what timeouts are for!

That said, what you could do is reducing the timeout. If the syncs are on a fast link (local area network) you might want to reduce the connection timeout to a second or so:
ssh -o ConnectTimeout=1  <hostName>


rsync, ssh

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] C: How to open a file (with pathname) creating non-existent dirs in this path? dedec0 Programming 1 04-02-2012 03:29 PM
[SOLVED] rsync execution issue with crontab - Have given full path to rsync too!! Prabagaran Linux - Server 6 04-15-2011 02:39 AM
rsync hangs Murdock1979 Ubuntu 2 08-30-2008 02:46 PM
rsync hangs and_deva Linux - Enterprise 2 11-11-2004 04:07 AM
using rsync - one of the folders in path has spaces??? jgruss Linux - Networking 10 07-07-2004 08:27 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:24 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration