restartSim.sh 373 B

123456789101112131415
  1. #!/bin/sh
  2. process="simCardCharge"
  3. ps -ef |grep "${process}" | grep -v grep
  4. pro_count=`ps -ef |grep "${process}" |grep -v grep | grep -v sh|wc -l`
  5. for i in `seq $pro_count`
  6. do
  7. SEARCH_PID=`ps -ef |grep "${process}" | grep -v grep |grep -v sh| sed -n '1p'|awk '{print $2}'`
  8. if [ $SEARCH_PID -ne 0 ]; then
  9. echo "kill pid "$SEARCH_PID
  10. kill -9 $SEARCH_PID
  11. fi
  12. done
  13. ./status.sh