I've been trying to track the progress of the data in a pipe, specifically in a large init script for a minecraft server. How would I go about using pv
to get an accurate readout of progress?
I've tried the following command, where $WORLDBACKUPSIZE
is the size of the folder to be backed up, $path
is the path that it should be backed up to, and $MCPATH/${WORLDNAME[$INDEX]}
is the folder that should be backed up, except that pv
stops halfway through due to the size being the size of the folder and it is only counting the compressed bytes that pass through.
I want it to count the bytes that are compressed in the tar command instead, so I can use the original size as the ending mark for the progress meter. Simply put, I'm trying to tar a folder and monitor progress using pv
. The total size that pv
is using to tell me an estimated percentage is based of the original size, while the size that it is measuring when the tar command is running is the compressed size so the progress bar stops early with the percentage completed at the end depending on the size of the compressed folder compared to the size of the original folder.
The command
WORLDBACKUPSIZE=`du -sk $WORLDSTORAGE/${WORLDNAME[$INDEX]} | cut -f 1`
is used to measure the folder that I want to back up.
The command
tar -hcjf - $MCPATH/${WORLDNAME[$INDEX]} | pv -reps ${WORLDBACKUPSIZE}k > $path
is used to measure the progress. How would I rearrange this so that I am measuring the progress by the number of bytes that are taken into the tar command, and not the number that are put out?
No comments:
Post a Comment