The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How can I get a processor's CPU Percentage? sangjinn High Level Programming 3 10-09-2008 08:28 AM
how do I calculate percentage ? the_learner High Level Programming 6 04-18-2007 04:40 PM
how to make percentage of a running script? jimmbp Shell Programming and Scripting 1 01-31-2006 02:41 PM
Computung Percentage preetikate UNIX for Dummies Questions & Answers 2 02-09-2004 10:13 AM
percentage sign in a drive mapping ? simon2000 UNIX for Advanced & Expert Users 2 09-17-2002 12:30 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-18-2008
wrapster wrapster is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 193
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!
  #2 (permalink)  
Old 05-18-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
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.
  #3 (permalink)  
Old 05-18-2008
wrapster wrapster is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 193
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
  #4 (permalink)  
Old 05-18-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
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.
  #5 (permalink)  
Old 05-18-2008
wrapster wrapster is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 193
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!
  #6 (permalink)  
Old 05-18-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
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
Optionally spice it with a bigger block size (bs=8192 perhaps).
  #7 (permalink)  
Old 05-23-2008
duderonomy duderonomy is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 17
well, there is this:
Lamby’s Blog “Can you get cp to give a progress bar like wget?”
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 07:29 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0