最新消息:

linux模拟cpu100%

系统 luther 380浏览 0评论

#! /bin/sh
# filename killcpu.sh
if [ $# -ne 1 ] ; then
echo "USAGE: $0 <CPUs>|stop"
exit 1;
fi

stop()
{
while read LINE
do
kill -9 $LINE
echo "kill $LINE sucessfull"
done < pid.txt
cat /dev/null > pid.txt
}

start()
{
echo "u want to cpus is: "$1
for i in `seq $1`
do
echo -ne "
i=0;
while true
do
i=i+1;
done" | /bin/sh &
pid_array[$i]=$! ;
done

for i in "${pid_array[@]}"; do
echo 'pid is: ' $i ';';
echo $i >> pid.txt
done
}

case $1 in
stop)
stop
;;
*)
start $1
;;
esac

 

linux高负载配置的方法

https://blog.csdn.net/heavenmark/article/details/82805260

转载请注明:应用享评 » linux模拟cpu100%

您必须 登录 才能发表评论!