![]() |
|
|
|
|
|||||||
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how do I calculate percentage ? | the_learner | High Level Programming | 6 | 04-18-2007 01:40 PM |
| how to make percentage of a running script? | jimmbp | Shell Programming and Scripting | 1 | 01-31-2006 10:41 AM |
| Computung Percentage | preetikate | UNIX for Dummies Questions & Answers | 2 | 02-09-2004 06:13 AM |
| percentage sign in a drive mapping ? | simon2000 | UNIX for Advanced & Expert Users | 2 | 09-17-2002 09:30 AM |
| How can I get a processor's CPU Percentage? | sangjinn | High Level Programming | 2 | 10-16-2001 10:31 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
how to get the percentage of completion? during a copy!
Hi all,
I would like to know how to introduce that progress bar or the %of completion during copy of files... In the sense,I am copying a few files onto RAM at the boot time.... These 2 files combined take about 550mb of ram,so instead of just having a blinking cursor till the copy is over,i thought of giving a percentage of completion value... But how do i do that? How to get that ,1%......10%......100%.. Something like this!! Pls advice! |
| Forum Sponsor | ||
|
|
|
|||
|
Some slow commands offer a hook to let you know how far they are getting. What are you using to copy the file?
Some versions of dd will report the transfer rate (the same report you get at the end) when you send them a SIGUSR1. So you could use dd to copy and signal it, say, once per second to get a progress report. Post-process it in your script to turn it into something user friendly. |
|
|||
|
i am using cp to copy the files!!!!
Can you specify accordingly... the reason is at the point in time when this copy is being made, the dd binaries are not loaded so i will have to do some extra work to get these as well.. So i would appreciate if we can keep the cp and yet provide some sort of user readability!!! thanks |
|
|||
|
Welp, unless your version of cp has hooks for this, the best you can do is guess. It's probably more aggravating than helpful if the guesstimated remaining time is completely off base, so perhaps it's just better to display a spinning cursor.
You could copy a smaller file first to calibrate, and then extrapolate a time estimation from that, but what if the disk gets jammed or another process accesses the disk at the same time? If you don't have dd, chances are any useful tools for cobbling together some eye candy won't be available either ... (I'd be hoping that dd is available if cp is, though.) Another approach would be to run cp in the background and watch the size of the destination file, and calculate a percentage from that. I'd be nervous about putting cp in the background and lose on error checking etc just to get some pretty text on the screen, though. |
|
|||
|
Thanks for the info,...
However the cp was not there in the ramdisk either,I had to relocate the binaries of cp frm another suitable OS then i was able to use it... So i will have to do the same with dd as well... How ever i am not familiar with dd... So if you could give me the command line of dd? and also if i use dd,how may i have the privalage of getting the % Thanks! |
|
|||
|
On second thought, I'm not sure it's any better than cp and monitoring the size of the destination file.
Anyway, before you invest heavily into it, check that your version understands SIGUSR1 -- not all of them do. dd has a notoriously iffy syntax. In fact I read somewhere that it was meant as a joke on the perversity of another syntax (JCL if I recall correctly) but somehow it just stuck. Code:
dd if=/path/to/input/file of=/path/to/output/file |
|
|||
|
well, there is this:
Lamby’s Blog “Can you get cp to give a progress bar like wget?” |
|
|||
|
The link youve provided is great but strace causes overhead,esp if the file is huge...
The file am copying is about 500mb and at boot time this will increase the time by a lot of secs..... I have however written a new script following up on the links that you have provided and from bit of surfing of my own.... Pls have a look at it, its in the next post!! |
|||
| Google UNIX.COM |
| Thread Tools | |
| Display Modes | |
|
|