Отправить результат команды top в файл или на email в Debian

пятница, 19 февраля 2016 г.

0 коммент.
Чтобы отправить результат команды top в файл в Debian недостаточно просто написать

top > /path/to/file.txt

Нам понадобится указать дополнительные параметры -b ("Batch mode") и -n (кол-во итераций):

top -n1 -b > /path/to/file.txt

Эта команда выдаст всю необходимую информацию аккуратно в файл.

Сможете даже отправить себе результат на email

top -n1 -b | mail -s "Email subject" your@email.com

Результат top просто придет на указанный email.

Справка об указанных доп. параметрах:
       -b : Batch mode operation
            Starts  top  in 'Batch mode', which could be useful for sending output from top to other programs or to a file.  In this mode, top will not accept input and runs until the iterations limit you've set with the '-n' command-line option or until killed.


       -n : Number of iterations limit as:  -n number
            Specifies the maximum number of iterations, or frames, top should produce before ending.

Copyright © 2010 WEB IT blog