Hi,
I want to write a unix script for vmstat every 10 Seconds .
In the Progrmme the code will be vmstat 10
I want to save it to a file.
I think we can give a parameter for example TWO Hours.
Thanks a lOt for your help.
**Korn Shell
LOOPCT=0
vmstat 600 |& # coprocess resample every 10 minutes
while read -p # while the coprocess if running
do
echo $REPLY
LOOPCT=$(($LOOPCT+1))
if [$LOOPCT -gt "50"
then
exit 0
fi
done
If you alter the loop count and vmstat seconds you can collect data for weeks at a time. This works the same for other similar utilities like netstat, etc. The first data line in the file should be disregarded as it is cumulative since the machine was rebooted.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.