Bash: easy way to put a configurable load on a system?
        Posted  
        
            by WizardOfOdds
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by WizardOfOdds
        
        
        
        Published on 2010-03-14T21:12:30Z
        Indexed on 
            2010/03/14
            21:15 UTC
        
        
        Read the original article
        Hit count: 295
        
bash
In order to test how a program reacts when system resources become scarce (mainly the CPU but I'm interested in disk I/O too), I'd like to put an arbitrary load on the system.
Currently I'm doing something like this:
#!/bin/bash
while true
do
    echo "a" >> a.txt
    md5 a.txt
done
I could also start mp3-encoding audio files, or whatever.
What would be an easy and small Bash script that could be used to simulate an arbitrary load, ideally configurable using parameter(s)?
© Stack Overflow or respective owner