Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11th December 2012, 11:14 PM
sid1881s Offline
Registered User
 
Join Date: Dec 2012
Location: USA
Posts: 1
windows_7firefox
How to write a shell script ?

Hi Everyone,

I am from the performance testing background and working on an application hosted on an app server having the Fedora OS. While load testing, I will need to collect the CPU, Memory and Disk metrics for the app server.

With regard to the same, I will need to write a shell script which will generate the output from the vmstat and iostat command at a sampling rate of 5 seconds and redirect to a single notepad.

I tried to google it but did not find any feasible solution. Can someone please help. It's urgent.

Thanks,
Sid
Reply With Quote
  #2  
Old 11th December 2012, 11:25 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,107
linuxfirefox
Re: How to write a shell script ?

You likely want the "sar" package - it already does most of this, and more accurately (kernel timers and such, If I remember right).

"sar" is "System Activity Report" and provides daemon services to record a lot of data, and at flexible intervals.
Reply With Quote
  #3  
Old 12th December 2012, 09:08 AM
george_toolan Offline
Registered User
 
Join Date: Dec 2006
Posts: 1,718
linuxfirefox
Re: How to write a shell script ?

Try

Code:
while true; do vmstat >> notepad; sleep 5; done
or to get more detailed information

Code:
cat /proc/vmstat
Reply With Quote
  #4  
Old 12th December 2012, 10:30 AM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,107
linuxfirefox
Re: How to write a shell script ?

The results of such a script is inaccurate - a sleep of 5 seconds makes an interval of 6 seconds since it takes a time to run vmstat....

Just doing "vmstat 5>log" will do the same thing slightly more accurately.

Sar will record more information more consistently and allow you to post process/select different data over the same time period.
Reply With Quote
Reply

Tags
script, shell, write

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to write a shell program for file copy rajdey1 Using Fedora 8 18th August 2008 04:51 AM
call remote shell script within an expect script PhillyFloyd Programming & Packaging 2 16th October 2007 10:29 PM
starting a shell script inside a php script gw348 Using Fedora 6 23rd April 2007 09:30 PM
need to run script Bourne-shell script armen Using Fedora 4 4th April 2005 01:16 PM


Current GMT-time: 22:49 (Friday, 24-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat