remind index of transfer every now and then
This commit is contained in:
@@ -100,11 +100,11 @@ def list_URLs(options):
|
|||||||
|
|
||||||
def start_sync(options):
|
def start_sync(options):
|
||||||
sync_list=get_list(options)
|
sync_list=get_list(options)
|
||||||
for sync in sync_list:
|
for i,sync in enumerate(sync_list):
|
||||||
(SRC,TGT)=sync
|
(SRC,TGT)=sync
|
||||||
if not SRC:
|
if not SRC:
|
||||||
return
|
return
|
||||||
print("Starting: %s -> %s"%(SRC,TGT))
|
print("Starting: #%d %s -> %s"%(i+1,SRC,TGT))
|
||||||
syncopts=shlex.split(options.options)
|
syncopts=shlex.split(options.options)
|
||||||
command=['rsync']
|
command=['rsync']
|
||||||
command.extend(syncopts)
|
command.extend(syncopts)
|
||||||
@@ -112,9 +112,13 @@ def start_sync(options):
|
|||||||
popen = subprocess.Popen(command,
|
popen = subprocess.Popen(command,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=8)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=8)
|
||||||
lines_iterator = iter(popen.stdout.readline, b"")
|
lines_iterator = iter(popen.stdout.readline, b"")
|
||||||
|
j=0
|
||||||
try:
|
try:
|
||||||
for line in lines_iterator:
|
for line in lines_iterator:
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
|
j+=1
|
||||||
|
if j%100==0:
|
||||||
|
print("#%d %s -> %s"%(i+1,SRC,TGT))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
popen.kill()
|
popen.kill()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@@ -124,9 +128,7 @@ def start_sync(options):
|
|||||||
for line in lines_iterator:
|
for line in lines_iterator:
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
print("FAILED: EC: %d, %s -> %s"%(popen.returncode,SRC,TGT))
|
print("FAILED: EC: %d, %s -> %s"%(popen.returncode,SRC,TGT))
|
||||||
|
print("Finished: #%d %s -> %s"%(i+1,SRC,TGT))
|
||||||
else:
|
|
||||||
print("Finished: %s -> %s"%(SRC,TGT))
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
options=setup_options();
|
options=setup_options();
|
||||||
|
|||||||
Reference in New Issue
Block a user