how to get the percentage of completion? during a copy!


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users how to get the percentage of completion? during a copy!
# 1  
Old 05-18-2008
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  
Old 05-18-2008
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  
Old 05-18-2008
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  
Old 05-18-2008
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  
Old 05-18-2008
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  
Old 05-18-2008
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  
Old 05-23-2008
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash-Completion, an example

Hello I've followed several bash-completion threads, usualy none were answered, because of obvious reasons. (of which i'm just aware since a day or a few) Non-the-less, because i was writing scripts, i never considered it to be possible to add this functionality. Also, because i though that... (0 Replies)
Discussion started by: sea
0 Replies

2. Shell Programming and Scripting

Identifying the file completion

Hi, A script is running for multiple databases so data is also being populated for multiple DBs in a.txt file. I need to rename this file once all the data is populated. Kindly suggest me How can I check once file is populated completely before renaming? Thanks in advance. (3 Replies)
Discussion started by: ravigupta2u
3 Replies

3. Shell Programming and Scripting

inotifywait to wait until completion

Hi, I am using inotifywait to monitor a directory where files are being transferred into. I want inotifywait to tell me when a file has been completely transferred not just part of it. I tried "create", "close" and "close_write" but it seems that inotifywait always gets triggered even if the... (4 Replies)
Discussion started by: jejeking
4 Replies

4. Shell Programming and Scripting

zsh and host completion

Hi there is there a way i can add to my .zshrc so that when i type rsh <tab> it takes the name for a list of hosts i know it looks in .ssh/know_hosts but i want it for rsh and for a list that i supply thanks A (4 Replies)
Discussion started by: ab52
4 Replies

5. UNIX for Dummies Questions & Answers

Background Process Completion

I have my unix machine configured to run locate.updatedb on login in the background and after it completes, when I run a command such as ls-- the console returns the results of ls and + Done sudo /usr/libexec/locate.updatedbIs there... (3 Replies)
Discussion started by: Prodiga1
3 Replies

6. Shell Programming and Scripting

bash completion

hello, I have been trying for a couple days to figure this out to no avail. I am converting some csh code to bash. I have converted everything except the completion code. #bashrc (I set this alias in my bashrc) alias test='source ${PATH}/test.sh' #${PATH}/test.sh (returns some aliases and... (0 Replies)
Discussion started by: platypuus
0 Replies

7. UNIX for Dummies Questions & Answers

Job Completion Information?

Hi, I am trying to get some information on the jobs that are running. I have used the "ps" command, to get information such as 'cpu usage', 'username', 'pid', etc., I've also used the "bjobs" command to get information such as 'submit time' and 'start time'. The only thing I need now is to... (3 Replies)
Discussion started by: davidfrank
3 Replies

8. Shell Programming and Scripting

Ensure the file completion ?

Hi, I would like to copy a file from one location to another. But that particular file is not fully loaded. I like to copy a file once it's fully loaded or complete file. How to ensure whether file is fully loaded or complete file?. -Thambi (5 Replies)
Discussion started by: thambi
5 Replies

9. UNIX for Dummies Questions & Answers

Tab Completion on Solaris 10

Hi, Is there a way to turn on tab completetion on Solaris 10? (2 Replies)
Discussion started by: annointed3
2 Replies

10. Shell Programming and Scripting

file name completion

I'ld like to enable file name completion in ksh88 on AIX 5.2. My terminal is set to xterm. I've set the shell editor to emacs and ampped the arrow keys. Is there a way to map the tab key to a command like ESC= or any other file name completion command in emacvs that I may be not aware of since I'm... (1 Reply)
Discussion started by: rein
1 Replies
Login or Register to Ask a Question