Created
March 11, 2016 23:57
-
-
Save akissu/9a63679c036af2aa2185 to your computer and use it in GitHub Desktop.
Shell script that performs a cp of source to destination and watches the process.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
CPFILEPATH=`readlink -f $1` | |
CPDSTPATH=`readlink -f $2` | |
CPFILESIZE=`stat --printf "%s" $1` | |
echo $CPFILEPATH: $CPFILESIZE Bytes | |
echo cp $CPFILEPATH $CPDSTPATH/. "&" | |
cp $CPFILEPATH $CPDSTPATH/. & | |
CPPID=`echo $!` | |
watch -n1 "cat /proc/$CPPID/fdinfo/* | grep pos| tail -n1 | awk '{print \$2,\"\\n$CPFILESIZE\"}'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment