Simple script loop question

Hey all. Thanks in advance for any help you can give, hopefully this is an easy one. I want to create a loop to run a simple performance monitor like vmstat and record it to a file, but have very limited scripting skills (obviously).

Starting with this...

date >> /var/log/perfmon.log
vmstat 3 10 >> /var/log/perfmon.log

I basically want it to sleep for 5 minutes using sleep 300, but how do I start the process again (restart the loop)?

Thanks

Use something like this:

while true; do date >> /var/log/perfmon.log; sleep 300; done &
vmstat 300 >> /var/log/perfmon.log &

Remember that you cannot run the vmstat command in a loop, as it will display cumulative stats the first time it runs.

Got it running right, finally. And yes, I am actually running vmstat 3 10 (collecting for 30 seconds) in the script. Thanks for the input though.