tonylight2016

批量停止相关进程

Nov 24th, 2020 (edited)
685
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. if [ $# -ne 1 ];then
  3.     echo "参数错误!"
  4.     exit -1
  5. fi
  6.  
  7. pids=`ps -ef | grep $1 | grep -v $0 | awk '{print $2}'`
  8. for pidd in $pids
  9. do
  10.     kill -9 $pidd
  11. done
  12.  
RAW Paste Data