You could probably put in some form of progress meter into your "rsh" (defaults to ssh) command.
I've attached my "reblock" command, which is somewhat similar to dd, but with the -t option it counts the number of kilobytes transmitted, as well as giving two throughput measures. reblock could easily be extended to give a percentage if you feed it the total size of the transfer - but please maintain an awareness that this may be a moving target. On Mon, 2004-09-27 at 12:03, Wayne Davison wrote: > On Sat, Sep 25, 2004 at 11:53:48AM -0400, Full Decent wrote: > > Is it functionally possible to have only one simple progress bar > > represent the whole rsync operation? > > You could have a percent represent how far in the file list we are, but > that is a very inaccurate indication of how much work is to be done. > This is because rsync doesn't know in advance how many files need to be > transferred nor how much data will match, so I don't think such a > progress bar would be very useful without adding an extra pre-pass > through all the files in the generator, counting up differences and > trying to create an estimate of how much work will need to be done > (perhaps based on file-size differences as a crude estimate). Such a > pre-pass would slow down rsync, so it's not something that would be > universally useful (probably only for smallish sets of files over a slow > net connection). > > ..wayne.. -- Dan Stromberg DCS/NACS/UCI <[EMAIL PROTECTED]>
#!/dcs/bin/python import select import sys import string import os def main(): verbose = 0 tp = 0 #sys.stderr.write(sys.argv[1]+'\n') # this really should use getopt! if sys.argv[1:] and sys.argv[1] == '-t': # thruput option tp = 1 import time size = 0 t0 = time.time() del sys.argv[1] if sys.argv[1:]: blocksize=string.atoi(sys.argv[1]) timeout=string.atof(sys.argv[2]) else: sys.stderr.write('usage: '+sys.argv[0]+' [-t] blocksize timeout\n') sys.stderr.write('-t reports on throughput\n') sys.stderr.write('blocksize is in bytes\n') sys.stderr.write('timeout is in seconds (floating point)\n') sys.exit(0) bigblock='' #sys.stderr.write(str(tp)+'\n') prevmin = 0 oserror=0 while 1: retval=select.select([0],[],[],timeout) if len(retval[0]) == 0: # timeout if verbose: sys.stderr.write('got timeout\n') finish(blocksize,bigblock,tp) break elif len(retval[0]) == 1 and retval[0][0] == 0: # got input if verbose: sys.stderr.write('select says ready to read\n') block = os.read(0,blocksize) if not block: # eof if verbose: sys.stderr.write('got eof\n') finish(blocksize,bigblock,tp) break if len(block) < blocksize and verbose: sys.stderr.write('got short block\n') bigblock=bigblock+block if len(bigblock) >= blocksize: try: os.write(1,bigblock[0:blocksize]) except OSError,value: oserror=1 if oserror: break if tp: # size is in bytes size = size + blocksize dt = time.time() - t0 #sys.stderr.write('Kbytes: '+str(int(size/1024))+\ #' megabits/s: '+\ #str(int(((size * 8) / (dt)) / (1024 * 1024)))+\ #' gigabytes/hr: '+\ #str(int((size / (dt)) / (1024*1024*1024)*(60*60)))+\ #' min: '+str(int(dt/60))+' \r') bitsps = float(size * 8)/float(dt) units=['bits/s','kilobits/s','megabits/s','gigabits/s','terabits/s','petabits/s'] i = 0 while 1: #sys.stderr.write(units[i]+'\n') if bitsps > 1024: bitsps = bitsps / 1024.0 i = i + 1 else: break if i == len(units) - 1: break curmin = int(dt/60) sys.stderr.write('Kbytes: '+str(int(size/1024))+\ ' '+units[i]+': '+\ str(bitsps)+\ ' gigabytes/hr: '+\ str(int((size / (dt)) / (1024*1024*1024)*(60*60)))+\ ' min: '+str(curmin)+' \r') if prevmin != curmin: sys.stderr.write('\n') prevmin = curmin bigblock=bigblock[blocksize:] else: sys.stderr.write('Something bizarre happened\n') sys.stderr.write(str(retval)+'\n') if oserror: sys.stderr.write('\n'+sys.argv[0]+' '+str(value)+'\n') def finish(blocksize,block,tp): # write what's left, and pad to an integral block size if len(block) > blocksize: sys.stderr.write('internal error: len(block) > blocksize\n') sys.exit(1) remainder = blocksize - len(block) oserror = 0 try: os.write(1,block+ (chr(0) * remainder)) except OSError,value: oserror=1 if tp: sys.stderr.write('\n') if oserror: sys.stderr.write(sys.argv[0]+' '+str(value)+'\n') #os.write(1,block+ (chr(0) * remainder)) main() sys.exit(0)
signature.asc
Description: This is a digitally signed message part
-- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html