LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   scripting logic (https://www.linuxquestions.org/questions/linux-newbie-8/scripting-logic-793185/)

sushil.cool 03-04-2010 09:59 AM

scripting logic
 
tell me how can i make a script to send the output of top command in mail.
i have to mail the output to another person ,plz tell me how can i do this

davidstvz 03-04-2010 10:16 AM

You can use:

top -b >> somefilename.txt

...to get readable top output in a file (note: >> will append data to the end of the file you named, or start a new file if it doesn't exist; use > if you want to start a new file each time).

To automatically mail that file as an attachment to an email... I'm not sure, but you could probably Google that info (like so):

http://www.linuxforums.org/forum/deb...e-nightly.html

TB0ne 03-04-2010 11:23 AM

Quote:

Originally Posted by sushil.cool (Post 3885630)
tell me how can i make a script to send the output of top command in mail.
i have to mail the output to another person ,plz tell me how can i do this

You read up on basic shell scripting, sit down, and write it. Research the mail and top commands.

As a rule, no one here is going to write your script for you. If you're having problems, post what you've written, and we'll help. If you want someone to write it for you, you're in the wrong place. Also, spell out your words.

MBybee 03-04-2010 11:41 AM

Usually the *stat programs are best for this. Things like iostat, vmstat, prstat, etc. You might want to look at using one of those.

Nmon is also good.


All times are GMT -5. The time now is 12:44 PM.