Results 1 to 3 of 3

Thread: write top processes into log file periodically

  1. #1
    Join Date
    Jul 2014
    Beans
    340

    Question write top processes into log file periodically

    Hi all,

    How do I write top processes into log file periodically?
    Thanks ahead.

  2. #2

    Re: write top processes into log file periodically

    Windows assumes the user is an idiot.
    Linux demands proof.

  3. #3
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: write top processes into log file periodically

    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:
    Code:
    top -n 1 | head -n 17 >> /path/to/logfile
    The first seven lines are the header at the top of the output, followed by ten lines of processes.

    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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •