[Bug 8188] Mechanism for taking an rsync server down for maintenance
samba-bugs at samba.org
samba-bugs at samba.org
Mon May 30 23:15:51 MDT 2011
https://bugzilla.samba.org/show_bug.cgi?id=8188
--- Comment #1 from Wayne Davison <wayned at samba.org> 2011-05-31 05:15:51 UTC ---
You could just setup something to echo a one-line message on the socket and
disconnect. If you're using xinetd, tweak the program to be anything that
outputs a message to stdout. To replace an rsync daemon, you may want to code
up a C program or use a simple perl script, like this (and run it instead of
the daemon):
#!/usr/bin/perl
use strict;
use warnings;
use Socket;
my $PORT = 873;
local *S;
socket(S, PF_INET, SOCK_STREAM , getprotobyname('tcp'))
or die "couldn't open socket: $!\n";
setsockopt(S, SOL_SOCKET, SO_REUSEADDR, 1);
bind(S, sockaddr_in($PORT, INADDR_ANY));
listen(S, 25) or die "listen failed: $!\n";
while (1) {
accept(CON, S);
print CON "The rsync server is down for maintenance.\n";
close CON;
}
Any connecting rsync will then output this:
rsync: server sent "The rsync server is down for maintenance." rather than
greeting
--
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the rsync
mailing list