progress - to monitor progress of commands

Issues related to applications and software problems
robertw
Posts: 189
Joined: 2012/04/25 13:26:59

progress - to monitor progress of commands

Post by robertw » 2017/09/13 14:07:26

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

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: progress - to monitor progress of commands

Post by jlehtone » 2017/09/14 06:12:34

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.

robertw
Posts: 189
Joined: 2012/04/25 13:26:59

Re: progress - to monitor progress of commands

Post by robertw » 2017/09/14 11:47:13

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?

robertw
Posts: 189
Joined: 2012/04/25 13:26:59

Re: progress - to monitor progress of commands

Post by robertw » 2017/09/15 15:38:21

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

robertw
Posts: 189
Joined: 2012/04/25 13:26:59

Re: progress - to monitor progress of commands

Post by robertw » 2017/09/20 08:30:14

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

tunk
Posts: 1206
Joined: 2017/02/22 15:08:17

Re: progress - to monitor progress of commands

Post by tunk » 2017/09/20 09:30:11

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.

robertw
Posts: 189
Joined: 2012/04/25 13:26:59

Re: progress - to monitor progress of commands

Post by robertw » 2017/09/20 15:51:28

whats with the &?

mghe
Posts: 766
Joined: 2015/11/24 12:04:43
Location: Katowice, Poland

Re: progress - to monitor progress of commands

Post by mghe » 2017/09/20 17:44:02

robertw wrote:whats with the &?
Process in background.

robertw
Posts: 189
Joined: 2012/04/25 13:26:59

Re: progress - to monitor progress of commands

Post by robertw » 2017/09/21 12:59:14

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?

robertw
Posts: 189
Joined: 2012/04/25 13:26:59

Re: progress - to monitor progress of commands

Post by robertw » 2017/09/21 13:06:12

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

Post Reply