Hi all,
How do I write top processes into log file periodically?
Thanks ahead.
Hi all,
How do I write top processes into log file periodically?
Thanks ahead.
Windows assumes the user is an idiot.
Linux demands proof.
You'll need to run top as "top -n 1 >> /path/to/logfile" so it will display one page then exit.
If you only want, say, the results for the first ten processes use:
The first seven lines are the header at the top of the output, followed by ten lines of processes.Code:top -n 1 | head -n 17 >> /path/to/logfile
You need to create an entry in cron to do this. See https://help.ubuntu.com/community/CronHowto
Last edited by SeijiSensei; June 10th, 2016 at 08:23 PM.
If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.
Blog · Linode System Administration Guides · Android Apps for Ubuntu Users
Bookmarks