Bug 4303 - pre-xfer exec prevents output redirection of invoked commands
Summary: pre-xfer exec prevents output redirection of invoked commands
Status: RESOLVED FIXED
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 2.6.9
Hardware: x86 Linux
: P3 normal (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-21 05:13 UTC by Koen Vereeken
Modified: 2006-12-21 08:12 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Koen Vereeken 2006-12-21 05:13:35 UTC
In my rsyncd.conf I have a pre-xfer exec defined:
[backup]
        comment = full backup
        pre-xfer exec = sh /etc/ntc/invoke_trigger backup all
        max connections = 1
        path = /var/lib/systemimager/backup
        read only = true
        use chroot = true
        list = true
        dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz

the invoke_trigger script will trigger machines by using an ssh connection:
ssh -qi privatekey -o StrictHostKeyChecking=no -l sshuser server1 backup > backup.sql
ssh -qi privatekey -o StrictHostKeyChecking=no -l sshuser server2 backup

the backup command is a script that will be executed on the corresponding machine.
When the backup script generates output to stdout, it won't be catched by the ssh in the invoke_trigger script. Also, the ssh connection to server1 and server2 won't be closed, so that the invoke_trigger script waits forever on the first command.

When i manually execute the invoke_trigger script, it all works perfect.
I guess rsync prevents output redirection on forks or something..

Is there a way to start the rsync daemon so that this works?
Has it anything to do in the way the rsync daemon starts?
(I start it on bash: rsync --daemon --config=/etc/rsyncd.conf)
Comment 1 Koen Vereeken 2006-12-21 08:12:37 UTC
fixed it myself, not an rsync issue :-)
the cause was ssh, which has no output redirection from forks coming from a non-shell (for instance rsync). adding the -n parameter to ssh solves this issue.