数据库
首页 > 数据库> > Redis 进程绑核shell脚本

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

标签:脚本,pidlet,shell,grep,endNum,Redis,startNum,cpuNum,cpuinfo
来源: https://blog.51cto.com/880314/2361788