Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rdiff-backup: improved error management

  • Loading branch information...
commit e73bc4e363fc09d8945d3fb87570735dda6d6bea 1 parent 6f2727b
@mbornoz mbornoz authored
Showing with 9 additions and 5 deletions.
  1. +9 −5 files/usr/local/sbin/multiprocessing-rdiff-backup.py
View
14 files/usr/local/sbin/multiprocessing-rdiff-backup.py
@@ -32,32 +32,36 @@ def backup(host):
env.append("%s/rdiff-backup-%s/%s/python%s.%s/site-packages" % (
_RBDIR, host['version'], l, sys.version_info[0], sys.version_info[1]))
- pa = subprocess.Popen(
+ proc = subprocess.Popen(
args,
env={"PYTHONPATH": ":".join(env)},
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True)
- status = os.waitpid(pa.pid,0)[1]
+ status = os.waitpid(proc.pid,0)[1]
+ output = proc.stdout.read()
+ if status: output += proc.stderr.read()
if not status:
args = []
args.append("%s/rdiff-backup-%s/bin/rdiff-backup" % (_RBDIR, host['version']))
args.extend(["--remove-older-than", host['retention'], "--force", host['destination']])
- pb = subprocess.Popen(
+ proc = subprocess.Popen(
args,
env={"PYTHONPATH": ":".join(env)},
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True)
- status = os.waitpid(pb.pid,0)[1]
+ status = os.waitpid(proc.pid,0)[1]
+ output += proc.stdout.read()
+ if status: output += proc.stderr.read()
# writes a logfile with rdiff-backup stdin and stderr
flog = open(logFile, 'w')
- flog.write(pa.stdout.read()+pb.stdout.read())
+ flog.write(output)
flog.write("RDIFF-BACKUP-EXIT-STATUS=%s\n" % status)
flog.close()
Please sign in to comment.
Something went wrong with that request. Please try again.