Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im trying to automate a long list of database experiments. I would like to save vmstat output while specific parts of the experiments are running.

Does something exist along the lines of time(1) or script(1) that I could use to say: " While this command is running, save vmstat 2(or similar) output to a file " in my bash scripts

I am aware that vmstat gives my vmstat for the complete system including other processes, but that is OK for my usage.

(Running Ubuntu 9.10 if that makes a difference)

share|improve this question
up vote 1 down vote accepted
vmstat 2 > ~/vmlog.txt &
kill $vmpid
share|improve this answer
I was hoping I didnt have to do it like that :) I have bad milage with the & operator and $! in my bash scripts (and dd) – svrist Apr 6 '10 at 9:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.