Adrian Diezig
2006-Mar-07 11:10 UTC
rsync doesn't exit (is hanging) in script, but not on command line!
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.
Wayne Davison
2006-Mar-07 16:05 UTC
rsync doesn't exit (is hanging) in script, but not on command line!
On Tue, Mar 07, 2006 at 11:54:55AM +0100, Adrian Diezig wrote:> rsync copies the files but the problem is, that the rsync command never > exits (is hanging)Did you try using 2.6.7pre3? This new release makes sure that all required signals are unmasked, and this fixes an failure-to-exit bug where a SIGUSR2 signal could get lost if a parent process had set an overly restrictive signal mask (SIGUSR2 is used in the exit events of the receiving side's pair of processes). ..wayne..
Gian G. Spicuzza
2006-Mar-07 17:10 UTC
rsync doesn't exit (is hanging) in script, but not on command line!
Hi, I don't know much about perl, but I can suggest doing a little upgrading. Perl is up to v5.8.8 Rsync is up to v2.6.7pre3 Your version of rsync is years old and is vulnerable to multiple security advisories. Thanks, Gian>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. > > > > > > >------------------------------------------------------------------------ > >_______________________________________ >Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html > >rsync mailing list >rsync@lists.samba.org >https://lists.samba.org/mailman/listinfo/rsync > >