--no-detach option?

Jos Backus josb at cncdsl.com
Tue Nov 27 06:01:26 EST 2001


On Mon, Nov 26, 2001 at 07:37:33PM +1100, Martin Pool wrote:
> I'll apply something like Jos's patch, with a modification to not
> create another bloody global variable but instead stick it in an
> options struct.

Good idea. Btw, Openssh also uses structs to pass options around.

> People who work with Apache should try the mostly-undocumented -X
> option, which tells it to not detach and also not fork on incoming
> connections.  For debugging that's even more useful.

<off-topic>
Yes, however 2.0.28 still has a problem with this; see my message with subject
``HAVE_SETSID'' problem on the apache-dev list, which unfortunately has been
ignored so far. I notified the maintainer of the FreeBSD port and he told me
he has submitted a bugreport to the Apache folks. So hopefully this problem
will be fixed at some point. The remaining issue with ``-X NO_DETACH'' is that
it keeps httpd from creating its own process group, even though it _kills_ the
process group it is in. This is bad news because this process group contains
svscan/supervise/etc. So what is needed for httpd is another option that only
causes apr_proc_detach() to call setsid()|setpgrp()|..., not the other stuff.
All this is really ugly anyway; httpd should simply keep track of its
children's pid's (I bet it does already) and kill() those instead of a process
group it doesn't own.
</off-topic>

S[ai]mple --no-detach manpage patch:

Index: rsync.1
===================================================================
RCS file: /cvsroot/rsync/rsync.1,v
retrieving revision 1.95
diff -u -r1.95 rsync.1
--- rsync.1	14 Aug 2001 02:04:49 -0000	1.95
+++ rsync.1	26 Nov 2001 18:46:24 -0000
@@ -296,6 +296,7 @@
      --include-from=FILE     don\'t exclude patterns listed in FILE
      --version               print version number
      --daemon                run as a rsync daemon
+     --no-detach             do not detach from the parent
      --address               bind to the specified address
      --config=FILE           specify alternate rsyncd\&.conf file
      --port=PORT             specify alternate rsyncd port number
@@ -714,6 +715,10 @@
 config file (/etc/rsyncd\&.conf) on each connect made by a client and
 respond to requests accordingly\&. See the rsyncd\&.conf(5) man page for more
 details\&. 
+.IP 
+.IP "\fB--no-detach\fP" 
+When running as a daemon, this option instructs rsync to not detach itself and
+become a background process\&.
 .IP 
 .IP "\fB--address\fP" 
 By default rsync will bind to the wildcard address


-- 
Jos Backus                 _/  _/_/_/        Santa Clara, CA
                          _/  _/   _/
                         _/  _/_/_/             
                    _/  _/  _/    _/
josb at cncdsl.com     _/_/   _/_/_/            use Std::Disclaimer;




More information about the rsync mailing list