check if a linux process is done using bash 检查进程是否在运行
# cat > check_process_is_end.sh
while true
do
sleep 30 # seconds
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.
#======================
# 监控某个进程运行时占用的内存
#======================
# cat > process_memory.sh
while true
do
sleep 30 # seconds
res=`ps aux | grep -w "RNAhybrid"`
date >> mylogs
echo $res >> mylogs
done
# chmod u+x process_memory.sh
# ./process_memory.sh
NOTE: RNAhybrid is a process name.