The Samba-Bugzilla – Bug 4303
pre-xfer exec prevents output redirection of invoked commands
Last modified: 2006-12-21 08:12:37 UTC
In my rsyncd.conf I have a pre-xfer exec defined:
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)
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.