SUSE/Novell – CLP

Wrote my CLP exam and passed on the 1st write. I was nervous for this exam as it was a practical exam.

Had some fun with scripting, where I had to use iostat, vmstat, mpstat in script and run them in parallel. Script work but not as expected. Did some reading up and found I could do it as below:

 

#!/bin/bash

DELAY=”2″

function start_moni (){
iostat ${DELAY} >iostat-stdout.txt 2>iostat-stderr.txt &
mpstat -P ALL ${DELAY} >mpstat-stdout.txt 2>mpstat-stderr.txt &
vmstat ${DELAY} >vmstat-stdout.txt 2>vmstat-stderr.txt &
}

function stop_moni () {
kill -9 `ps -fea | grep -i iostat | grep -v grep | awk ‘{print $2}’`
kill -9 `ps -fea | grep -i mpstat | grep -v grep | awk ‘{print $2}’`
kill -9 `ps -fea | grep -i vmstat | grep -v grep | awk ‘{print $2}’`

}

case “$1” in
start)
echo -ne “\n .. start ..\n\n”
start_moni
;;
stop)
echo -ne “\n .. stop ..\n\n”
stop_moni
;;
*)
echo -ne “\n Usage: $0 stop|start \n\n”
esac
exit 0

(257)

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.