rsync unexplained error & received SIGINT, SIGTERM, or SIGHUP

I created a batch script to back-up our server:

#!/bin/bash

user=$1

# create user dir
ssh [email protected] -p 5774  mkdir -p /var/backup/server.tst/incremental/$user

# backup mail dir
rsync -rvz --del --rsh='ssh -p5774' /home/$user/imap [email protected]:/var/backup/server.tst/incremental/$user 

cd /home/$user/domains
ls -1 | while read -r domain
do
        sh /etc/pxl/backup/domain.sh $user $domain
done

But when I'm running it sh script.sh username it hangs.

First I get sending incremental file list and after that is does not respond any more. When I press ctrl-C (abort script) the output changes:

sync error: unexplained error (code 130) at rsync.c(543) [sender=3.0.7]
sending incremental file list
public_html/gh.html
public_html/index.php
public_html/cgi-bin/.htaccess
public_html/... (and so on)

.. but hangs again. When I press ctrl-C again, I get:

rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(543) [sender=3.0.7]

On both sides I have the same version installed (3.0.7, protocol 30). I already read this topic, but that does not resolve my issue.

Does anybody know what is going wrong here? How can I solve it? Thank you in advance!


Solution 1:

Try running the script with a -v (or 2). The verbose output will show you where/why it is stalling. Also, validate your escaped characters and absolute paths. They are fairly common reasons for rsync to stall.