Page 1 of 2

progress - to monitor progress of commands

Posted: 2017/09/13 14:07:26
by robertw
hi all,

i have found a really good command that monitors the progress of a bunch of commands, its here -

https://github.com/Xfennec/progress

once installed you can run this command -

cp -r /mnt/local/data/call_the_midwife_7_1708/ /mnt/local/data/new/

then open a new terminal and run this command -

watch -n 0.5 progress -w

this will give you this -

Every 0.5s: progress -w Wed Sep 13 15:05:16 2017

[12254] cp /mnt/local/data/call_the_midwife_7_1708/Promo/grading_output/for_approval/170818_ctm_7_mipcom_graded_1-1_10bit_422_ycc_f2l_bl_or/192
0x1080/170818_ctm_7_mipcom_graded_1-1_10bit_422_ycc_f2l_bl_or_V1.mxf
19.6% (2.3 GiB / 11.9 GiB) 27.4 MiB/s remaining 0:05:55

has anyone heard of this

but this gives you details of individual files being copied over, i need something that can give me the ETA and percent of the whole directory copied over and not just individual files?

rob

Re: progress - to monitor progress of commands

Posted: 2017/09/14 06:12:34
by jlehtone

Code: Select all

rsync -a --progress /mnt/local/data/call_the_midwife_7_1708/ /mnt/local/data/new/
does show something more, but watching that output should make it clear that ETA and percentage are far from trivial.

Re: progress - to monitor progress of commands

Posted: 2017/09/14 11:47:13
by robertw
mmm...

got me thinking can i use the command pv and progress together to get the total ETA/percent of the whole directory instead of an ETA/percent of each individual file in the directory?

Re: progress - to monitor progress of commands

Posted: 2017/09/15 15:38:21
by robertw
smashed it -

[root@robw-linux data]# tar -c call_the_midwife_7_1708/ | pv -lep -s 32455212 | tar -x -C /mnt/local/data/new/
[=> ] 2% ETA 2:34:31

and to find the dir size i did -

du -s call_the_midwife_7_1708/

but doing it via this method takes ages as its creating the tar and extracting the tar, normally doing a normal copy only takes roughly 18 minutes

Re: progress - to monitor progress of commands

Posted: 2017/09/20 08:30:14
by robertw
just thought of another idea -

il get the size of the source path -

du -s /source_path/

then i will start the copy -

cp -r /source_path/ /destination_path/

while im copying i will monitor the progress -

watch -n 0.5 du -s /destination_path/

but i want to do this all in a bash script but my issue is it wont watch the destination path while the copy is going on, how do i do both at the same time

rob

Re: progress - to monitor progress of commands

Posted: 2017/09/20 09:30:11
by tunk
Could you try to put an ampersand at the end: cp -r /source_path/ /destination_path/ &
Edit: depending on the size of your directory, the du command may take longer than 0.5s.

Re: progress - to monitor progress of commands

Posted: 2017/09/20 15:51:28
by robertw
whats with the &?

Re: progress - to monitor progress of commands

Posted: 2017/09/20 17:44:02
by mghe
robertw wrote:whats with the &?
Process in background.

Re: progress - to monitor progress of commands

Posted: 2017/09/21 12:59:14
by robertw
nice, thanks for that neat trick

so any command i put a & at the end, it means its going to run in the background and go to the next line in the script straight away?

Re: progress - to monitor progress of commands

Posted: 2017/09/21 13:06:12
by robertw
i have seen this -

https://stackoverflow.com/questions/238 ... es#tab-top

if you read the answer by mitch he has made a script that does this with echo commands

but when i try it and run it on my linux box i just get 33, 66, 100% with the hashes, how can i get this to count up from 1-100

also how can i implement this with my copy command "cp -r /source /dest"

many thanks,

rob