Without seeing the actual script it's difficult to know what kind of commands you are using for your file operations.
One very simple option could be to simply create a temporary file once your copy/move action is finished, like this
#copy action
cp $1 /home/user/backup/
touch /tmp/finished.tmp
and then check if the file is there or if there are recent changes with
ls -lha /tmp/finished
or for an automatic periodic check
watch ls -lha /tmp/finished
Depending on your needs you could name each temporary file like the copy/move job it represents, maybe all in the same directory
# set the variable JOBNAME via input or via sourcename
# JOBNAME=$SOURCE
# JOBNAME=$2
mkdir /tmp/copyjobs
# your copy job here
touch /tmp/copyjobs/finished.$JOBNAME.tmp
# your next copy job here
touch /tmp/copyjobs/finished.$JOBNAME.tmp
Then watch the whole directory
watch ls -lha /tmp/copyjobs/
Depending on your skill you can also use loops and so on.
Tools like rsync have a built in progress bar for the commandline, so you can see how far along your job is with --progress or -P.
But rsync might not be the right tool for the job.
mv
orcp
? Then the simple commandsync
will do the trick. As soon assync
returns, the file transfer is complete. – DamBedEi Jan 15 '18 at 12:44nautilus --no-desktop & pid=$!
and check for its pid, but I think it will not really help, because nautilus does not stop when it has finished writing. And furthermore, the write process is probably buffered (and not really finished) anyway. I think usingsync
andiotop
(as in my answer) will give you useful information, even if they do not answer your question exactly. – sudodus Jan 15 '18 at 18:56