Bug 3778 - rsync triggers ( pre/post xter scripts )
Summary: rsync triggers ( pre/post xter scripts )
Status: RESOLVED WORKSFORME
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 2.6.8
Hardware: Sparc Solaris
: P3 major (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-15 14:08 UTC by Hemant Rumde
Modified: 2006-10-15 11:26 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 Hemant Rumde 2006-05-15 14:08:40 UTC
I am syncing some business data between two solaris servers. I am using post-xfer script to generate Email traps for non-zero exit status. However the exist status is always -1 

See the output of set command mailed by sendmail to check RSYNC environment vars.
RSYNC_EXIT_STATUS=-1
RSYNC_HOST_ADDR=172.29.146.49
RSYNC_HOST_NAME=minttest.id.citistreet.org
RSYNC_MODULE_NAME=TMP
RSYNC_MODULE_PATH=/tmp/TMP
RSYNC_RAW_STATUS=-1
RSYNC_USER_NAME=''

Is this a bug or I am not using proper config file. See the config section in 
rsyncd.conf 

log file = /tmp/RSYNC2.8.log
[TMP] 
path    = /tmp/TMP
comment = /tmp/TMP
read only = false
uid = zhrumde
gid = tivoli
#pre-xfer  exec = /tmp/send_mail.ksh
post-xfer exec = /tmp/send_mail.ksh

Thanks 
Hemant Rumde
CitiGroup 
Boston MA
Comment 1 Wayne Davison 2006-05-30 14:35:57 UTC
A -1 in RSYNC_RAW_STATUS means that the waitpid() call failed for some reason (the reason is not currently logged).

In order for rsync to be able to run the post-xfer script with full permissions (i.e. outside any chroot, and as the original daemon user), it forks prior to the copy, and the parent process just waits around for the child to do the copy and exit.  For some reason, the parent process is getting an error back from waitpid() instead of the exit status.

I'd suggest running the daemon under a system-call logging tool (use rsync --daemon --no-detach to make things easier) and you will be able to see what happens with the waitpid() call.
Comment 2 Wayne Davison 2006-10-15 11:26:56 UTC
Closing due to lack of response.  Please feel free to add new information should this arise again.