首页 > 代码库 > 杀死所有的kitchen进程

杀死所有的kitchen进程

#! /bin/bash

#kill 所有kitchen 进程
iplist=(
10.130.2.245

)


function killkitchen()
{
pid=`ps aux | grep kitchen.sh | awk ‘{ if ($11!=grep) {print $2;}}‘| wc -l`
if [[ $pid -gt 1 ]]
then
kill -9 $(ps aux | grep kitchen.sh | awk ‘{ if ($11!=grep) {print $2;}}‘)
else
echo successful
fi

}

for host in ${iplist[*]};
do
killkitchen $host
done

杀死所有的kitchen进程