LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-04-2010, 10:59 AM   #1
sushil.cool
LQ Newbie
 
Registered: Mar 2010
Posts: 15

Rep: Reputation: 0
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
 
Old 03-04-2010, 11:16 AM   #2
davidstvz
Member
 
Registered: Jun 2008
Posts: 405

Rep: Reputation: 30
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

Last edited by davidstvz; 03-04-2010 at 11:18 AM.
 
Old 03-04-2010, 12:23 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,919

Rep: Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689
Quote:
Originally Posted by sushil.cool View Post
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.
 
Old 03-04-2010, 12:41 PM   #4
MBybee
Member
 
Registered: Jan 2009
Location: wherever I can make a living
Distribution: PC-BSD / FreeBSD / Debian / Ubuntu / Win7 / OpenVMS
Posts: 438

Rep: Reputation: 57
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LSI Logic / Symbios Logic 53c875 (rev 14) -> HP Storageworks 1/8 G2 gileravxr Linux - Hardware 0 07-21-2009 05:45 AM
dd with logic volume ekdya Fedora 4 02-08-2007 04:42 AM
teaching shell scripting: cool scripting examples? fax8 Linux - General 1 04-20-2006 05:29 AM
Scripting entries into mysql with logic spiffytech Linux - Software 1 01-16-2006 03:55 AM
logic h/w Programming 8 01-02-2004 05:44 PM


All times are GMT -5. The time now is 01:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration