Redis 进程绑核shell脚本

#!/bin/bash

cpuNum=cat /proc/cpuinfo | grep processor | wc -l
let coreNum=$cpuNum-1
redisPid=ps aux | grep redis-server | grep -v grep | awk '{print $2}'
startNum=0
endNum=1

for pid in $redisPid
do
echo taskset -pc $startNum,$endNum $pid
let startNum=$startNum+2
let endNum=$startNum+1
done
echo "finish"
exit 0

上一篇:Linux查看cpu信息


下一篇:Linux查看CPU