监控程序运行bash

#!/bin/bash
your_name='CjsD1M04Shift19'

while [ 0 ]
do   
pid_cnts=$(ps -ef | grep  $your_name| grep -v grep | awk '{print $2}' | wc -l)
if [ $pid_cnts -eq 0 ];
  then
    echo "run program"
    cd strategy/FjsD1M04Shift19/
    mpiexec -n 3 ./FjsD1M04Shift19
    exit
else
    echo "process count = $pid_cnts."
    sleep 10s
fi
done
发布了13 篇原创文章 · 获赞 7 · 访问量 5983

猜你喜欢

转载自blog.csdn.net/kangseung/article/details/104991960