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.

Our application is using a very busy MySQL database with lots of reads, sometimes I don't want to look at the MySQL log files, I just want the output from mytop for the last 5 minutes. How do I write the output from mytop to a file?

Given that "mytop -u root --prompt > database.load" does not work?

Update I was using --prompt instead of -p with the -b flag, which kept on throwing an exception. So the solution would have been to do mytop -u root -p password > database.load

share|improve this question

1 Answer 1

You could use the -b option from mytop. From the manual page:

   -b or --batch or --batchmode
       In batch mode, mytop runs only once, does not clear the screen, and places no limit on the number of lines it will
       print. This is suitable for running periodically (perhaps from cron) to capture the information into a file for later
       viewing. You might use batch mode in a CGI script to occasionally display your MySQL server status on the web.

       Default: unset.
share|improve this answer

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.