Progress bar

Hi Experts;

Im in the process of writing a shell script for enabling an IT operations to run archiving.We use netbackup. The script is complete, though there is one bit that i need help on. Im trying to have a progess bar for the procedure.I have gone through the man page of the command in question and there was no hint of it. Following is the code snippet

/usr/openv/netbackup/bin/bparchive  -f  $INP_DIR/$INPFIL -L $LOG_ARCH_C_F 

sleep 20


while [[ `ps -ef | grep "$LOG_ARCH_C_F" | grep -v grep |wc -l` != 0 ]]

do

sleep 1 ; echo "#"

done

clear

echo "Archive Complete !!"

For progress bar... try this.. with printf

for i in {1..10}; do sleep 1 ;  printf "#"; done

or with echo -n ...

for i in {1..10}; do sleep 1 ;  echo -n "#"; done

Hi there,

I did try that, would it be possible to have an progress bar dependent on the process ( in the above case bparchive) rather than using for (1...10)

thanks

Progress bar dependent on the process status..? I don't think so we can easily configure this..
But if you know the average duration of time or if you can have some indicator that will show how much time it will need more.

Better way find the average time and set the sleep accordingly. And check the script status. And display progress bar..

Hope this helps you..:slight_smile:

I tried the following

spinner()
{
    local pid=$1
    local delay=10
    local spinstr='|/-\'
    while [ "$(ps a | awk '{print $1}' | grep -E "$pid|bpbkar32")" ]; do
        local temp=${spinstr#?}
        printf " [%c]  " "$spinstr"
        local spinstr=$temp${spinstr%"$temp"}
        sleep $delay
        printf "\b\b\b\b\b\b"
    done
    printf "Archiving in Progress ..   \b\b\b\b"
}

snipper $!

How ever what happens is when the command bparchive initiates it invokes a different command (bpbkar32) and not be seen in the ps listing.

Any help would be highly appreciated

Why not just try pgrep $pid ?

--ahamed