summaryrefslogtreecommitdiff
path: root/rdiff-backup/testing/server.py
blob: 17e11cad44869c51e5d1bb1c0c31c9278ae09cc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python

import sys, os

__doc__ = """

This starts an rdiff-backup server using the existing source files.
If not run from the source directory, the only argument should be 
the directory the source files are in.
"""

def print_usage():
	print "Usage: server.py  [path to source files]", __doc__

if len(sys.argv) > 2:
	print_usage()
	sys.exit(1)

try:
	if len(sys.argv) == 2:
		olddir = os.getcwd()
		os.chdir(sys.argv[1])
	execfile("setconnections.py")
	if len(sys.argv) == 2: os.chdir(olddir)
except (OSError, IOError):
	print_usage()
	raise

#Log.setverbosity(9)
PipeConnection(sys.stdin, sys.stdout).Server()