23 lines
		
	
	
		
			676 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			676 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/bash
 | 
						|
 | 
						|
# 指定要查找并杀死的进程名称列表
 | 
						|
target_processes=("rkipc" "rkwifi_server" "wpa_supplicant" "udhcpc")
 | 
						|
 | 
						|
# 遍历进程名称列表
 | 
						|
for target_process in "${target_processes[@]}"; do
 | 
						|
  # 使用pgrep命令查找目标进程的PID
 | 
						|
  pids=$(pgrep -f "$target_process")
 | 
						|
  
 | 
						|
  # 检查是否找到目标进程
 | 
						|
  if [ -z "$pids" ]; then
 | 
						|
    echo "未找到目标进程: $target_process"
 | 
						|
  else
 | 
						|
    echo "找到以下目标进程并准备杀死它们:"
 | 
						|
    for pid in $pids; do
 | 
						|
      echo "进程: $target_process,PID: $pid"
 | 
						|
      # 使用kill命令杀死目标进程
 | 
						|
      kill -9 "$pid"
 | 
						|
    done
 | 
						|
    echo "所有$target_process进程已被杀死"
 | 
						|
  fi
 | 
						|
done |