Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

up vote 1 down vote accepted
vmstat 2 > ~/vmlog.txt &
vmpid=$!
my_funky_command
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

 
discard

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.