I have two scripts to put a spike on CPU .
infinite_loop.bash :
#!/bin/bash
while [ 1 ] ; do
# Force some computation even if it is useless to actually work the CPU
echo $((13**99)) 1>/dev/null 2>&1
done
cpu_spike.bash :
#!/bin/bash
# Either use environment variables for NUM_CPU and DURATION, or define them here
for i in `seq ${NUM_CPU}` : do
# Put an infinite loop on each CPU
infinite_loop.bash &
done
# Wait DURATION seconds then stop the loops and quit
sleep ${DURATION}
killall infinite_loop.bash
The script was earlier working fine. BUt now the scriptis not working fine. Its giving me an error :
./cpu_spike.bash: line 5: syntax error near unexpected token `infinite_loop.bash'
./cpu_spike.bash: line 5: ` infinite_loop.bash &'