Question: I have an IP list that runs an rsync commands on a bunch of IP addresses.

However if a particular IP address in the file is offline, I get the following error code:

```
rsync: connection unexpectedly closed (0 bytes received so far) 
[sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.1]

```

Is there anyway to skip an IP if offline and carry on running against the rest of the IP's or set a timeout on trying and continue.

Answer: 
Check it's available and run the `rsync` command only if successful. (This assumes that `ping` success equates to a remote login for `rsync`. Not guaranteed to be true in every situation but it can cover many of them.)

```
remote=192.168.1.1
ping -c1 -w3 -q "$remote" && rsync -avP src/ "$remote:dst"

```

The flags to `ping` tell it to wait for up to three seconds but continue as soon as it receives one response.

There are also timeout parameters for `rsync` (see the man page; search for `timeout`) but in my experience these can trigger on the transmission of a large file so I do not find them particularly useful.
I came right with this.

My script had set -e in it, which sets it to exit if something fails.

So with Rsync failing to connect to a store, it stops the whole script, once I removed that it worked.