rsync doesn't exit (is hanging) in script, but not on command line!

Adrian Diezig diezig at genesiscom.ch
Tue Mar 7 10:54:55 GMT 2006


I have two identical (HW&SW) linux servers in my network. On both there is a
user called qipadmin, which can access over SSH to each other.
I wrote a perl script, which should copy files with rsync from one server to
the other. Below is the rsync command in the script.
The script is invoked by the root user.

system "su - qipadmin -c 'rsync -e ssh -p
$otherip:/opt/named/current/conf/db.* /opt/named/current/conf --exclude
*.jnl*'"

rsync copies the files but the problem is, that the rsync command never
exits (is hanging) and so the script cannot continue (unless I do manual
kill of the rsync process):

ps -ef | grep rsync
root     21290 21259  0 10:54 ?        00:00:00 su - qipadmin -c rsync -e
ssh -p 10.10.1.242:/opt/named/current/conf/db.*
/opt/named/current/conf --exclude *.jnl*
qipadmin 21291 21290  0 10:54 ?        00:00:00 rsync -e ssh -p
10.10.1.242:/opt/named/current/conf/db.* /opt/named/current/conf --exclude
*.jnl*
qipadmin 21384 21291  0 10:54 ?        00:00:00 rsync -e ssh -p
10.10.1.242:/opt/named/current/conf/db.* /opt/named/current/conf --exclude
*.jnl*

On the command line I can do the following without any problems (rsync exits
successfully):

su - qipadmin -c 'rsync -e ssh -p 10.10.1.242:/opt/named/current/conf/db.*
/opt/named/current/conf --exclude *.jnl*'


What is the difference between

system "<cmd>" (perl)

and

<cmd> (shell command line)?

Or is there a bug in rsync?

additional infos:
- rsync version: 2.5.7
- kernel: 2.4.32
- perl: 5.8.0


I hope there is somebody who can help me. I'm very frustrated.





More information about the rsync mailing list