Created
January 27, 2015 21:36
-
-
Save stackdump/08bf607e9eb29327988e to your computer and use it in GitHub Desktop.
bash script to max out cp load
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
function cpuConsumingFunc { | |
echo 'worker started' | |
dd if=/dev/urandom | bzip2 -9 >> /dev/null; | |
} | |
function fulload { | |
x=0 | |
while [ $x -lt $1 ]; do | |
cpuConsumingFunc & | |
let x=x+1 | |
done | |
}; | |
echo "----- Starting CPU load" | |
fulload $1; | |
echo "Press enter to stop CPU load" | |
read; | |
echo "----- CPU load stopped" | |
killall dd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment