首页 > 代码库 > check if a linux process is done using bash

check if a linux process is done using bash

# cat > check_process_is_end.sh


while true
do
   sleep 30
   res=`ps -ef | grep RNAhybrid`
   count=`grep -o "RNAhybrid" <<<"$res" | wc -l`
   if [ "$count" -eq "1" ] ; then
        echo $res
        echo -en "\007"
        sleep 1        
        echo -en "\007"  
        sleep 1        
        echo -en "\007"  
   fi
done


# chmod u+x check_process_is_end.sh
# ./check_process_is_end.sh

 

NOTE: RNAhybrid is a process name.