[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[rdiff-backup-users] patch for plain tcp connection(for rdiff 1.0.4)
From: |
catam |
Subject: |
[rdiff-backup-users] patch for plain tcp connection(for rdiff 1.0.4) |
Date: |
Wed, 8 Mar 2006 17:44:53 +0200 (EET) |
Hi
I want that rdiff-backup connects direcly to a remote server using TCP
so since this is not supported on client side I did a small patch(below)
On remote side just use inetd/xinetd/whatever like this:
#cat /etc/xinetd.d/rdiff-backup
service rdiff-backup
{
socket_type = stream
protocol = tcp
wait = no
user = root
only_from = 192.168.0.34
server = /usr/bin/rdiff-backup
server_args = --server --restrict-read-only /
port = 499
disable = no
bind = 192.168.0.1
}
on local side:
# rdiff-backup --remote-schema "tcp:%s:499" 192.168.0.1::/etc backups/etc
if remote-schema do not start with tcp: then behaviour is unchaged
and the patch:
diff -u SetConnections.py_bak SetConnections.py
--- SetConnections.py_bak 2006-03-08 14:02:31.000000000 +0200
+++ SetConnections.py 2006-03-08 17:29:22.000000000 +0200
@@ -25,7 +25,7 @@
"""
-import os, sys
+import os, sys, socket
from log import Log
import Globals, connection, rpath
@@ -129,7 +129,15 @@
if not remote_cmd: return Globals.local_connection
Log("Executing " + remote_cmd, 4)
- stdin, stdout = os.popen2(remote_cmd)
+ a = remote_cmd.split(':')
+ if a[0] == "tcp":
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.connect((a[1], int(a[2])))
+ stdin = stdout = s.makefile()
+ s.close
+ else:
+ stdin, stdout = os.popen2(remote_cmd)
+
conn_number = len(Globals.connections)
conn = connection.PipeConnection(stdout, stdin, conn_number)
catam
- [rdiff-backup-users] patch for plain tcp connection(for rdiff 1.0.4),
catam <=