#!/bin/bash
process_name="your_process_name"
pid=$(ps -ef | grep "$process_name" | grep -v grep | awk '{print $2}')
if [[ -n $pid ]]; then
echo "Killing process $pid"
kill -9 $pid
else
echo "Process $process_name not found"
fi
shell脚本获取进程号并杀死进程,批量kill进程
于 2024-01-04 09:42:48 首次发布