LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 12-08-2010, 08:16 AM   #1
srrijith
LQ Newbie
 
Registered: Dec 2010
Posts: 11

Rep: Reputation: 0
How to write a wrapper script for iostat


I need to write a wrapper script for iostat functionality . in solaris unix i have iostat but in linux i dont have iostat , so I need to write a wrapper script which does all the functionality of iostat . can anyone help me? i am entirely new to scripting
 
Old 12-08-2010, 08:43 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by srrijith View Post
I need to write a wrapper script for iostat functionality . in solaris unix i have iostat but in linux i dont have iostat , so I need to write a wrapper script which does all the functionality of iostat . can anyone help me? i am entirely new to scripting
First, iostat is available for Linux. If you don't have it, you can install it. Since you don't say what version/distro of Linux, we can't tell you how.

Second, if you need help writing a script, there are thousands of scripting tutorials you can find easily with Google. They can help you get started, and please come back and post any specific problems/questions you have (along with your script), and we can try to help.
 
Old 12-08-2010, 09:04 AM   #3
srrijith
LQ Newbie
 
Registered: Dec 2010
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for your reply.
I need to writer a wrapper script for iostat -c and iostat -E . not sure how to start with.
if you can kindly help me then I would be very thankful to you...

Regards,
Sree
 
Old 12-08-2010, 10:14 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by srrijith View Post
Thanks for your reply.
I need to writer a wrapper script for iostat -c and iostat -E . not sure how to start with.
if you can kindly help me then I would be very thankful to you...
You don't say what you're trying to do, what you want to see, etc., so how can anyone here help you write it?

If you don't know how to write a script, then as I suggested before, go to Google, type in "linux bash scripting tutorials", and press ENTER. Pick one of the thousands of hits, and go from there. Again, we are NOT going to write your script for you, but will HELP you if you get stuck...you will need to post what you've written, and what problems you have.
 
Old 12-08-2010, 10:21 AM   #5
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
You don't really want a wrapper.

In Linux you want to install the sysstat package. That contains iostat, vmstat, mpstat, and sar.
 
Old 12-08-2010, 07:25 PM   #6
srrijith
LQ Newbie
 
Registered: Dec 2010
Posts: 11

Original Poster
Rep: Reputation: 0
thanks...
iostat is in my linux...
but my requirement is to write a script which helps me to call iostat indirectly like .. instead of calling iostat -c
it will be myiostat -c . can you help me to write a script which does this
 
Old 12-08-2010, 07:26 PM   #7
srrijith
LQ Newbie
 
Registered: Dec 2010
Posts: 11

Original Poster
Rep: Reputation: 0
iostat is in my linux...
but my requirement is to write a script which helps me to call iostat indirectly like .. instead of calling iostat -c
it will be myiostat -c . can you help me to write a script which does this
 
Old 12-08-2010, 07:31 PM   #8
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Quote:
Originally Posted by srrijith View Post
thanks...
iostat is in my linux...
but my requirement is to write a script which helps me to call iostat indirectly like .. instead of calling iostat -c
it will be myiostat -c . can you help me to write a script which does this
That is nothing like what you originally said. It doesn't make any sense to me.
Code:
#!/bin/bash

iostat "$@"
What's the point?
 
Old 12-08-2010, 08:13 PM   #9
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Welcome to LQ!


So you've shown us your need! What's your deed?

We will aid you when you help yourself to a solution. Provide us with what you have attempted and then maybe someone will be able to assist.

Linux Shell Scripting Tutorial v1.05r3 A Beginner's handbook tutorial is designed for beginners who wish to learn the basics of shell scripting/programming plus introduction to power tools such as awk, sed, etc.

Start out at items 4, 5 and 6 below.



Just a few links to aid you to gaining some understanding;


1 Linux Documentation Project
2 Rute Tutorial & Exposition
3 Linux Command Guide
4 Bash Beginners Guide
5 Bash Reference Manual
6 Advanced Bash-Scripting Guide
7 Linux Newbie Admin Guide
8 LinuxSelfHelp
9 Getting Started with Linux

The above links and others can be found at 'Slackware-Links'. More than just Slackware® links!
 
Old 12-08-2010, 08:32 PM   #10
srrijith
LQ Newbie
 
Registered: Dec 2010
Posts: 11

Original Poster
Rep: Reputation: 0
as you said i need a script like .

#! /bin/ksh

function myiostat
{

# Built in commands used in this function
CMD_USR_PATH="/usr/bin"
CMD_PATH="/bin"

.........
[[ $1 = "-E" ]]
then

.......




return

}


does anyone knows to write this type of script. ?
 
Old 12-08-2010, 09:06 PM   #11
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by srrijith View Post
as you said i need a script like .

#! /bin/ksh
function myiostat
{
# Built in commands used in this function
CMD_USR_PATH="/usr/bin"
CMD_PATH="/bin"

.........
[[ $1 = "-E" ]]
then
.......
return
}

does anyone knows to write this type of script. ?
Yes. Now, go back to my first post, and re-read the part about looking up scripting tutorials. Again, we are NOT going to write this script for you, but we will HELP you with it. There are many, many examples to help you along.
 
Old 12-08-2010, 11:44 PM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Some scripting tutorials

http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/

There's more than enough info there to make you an expert, if you only apply yourself.
 
Old 12-09-2010, 12:04 AM   #13
srrijith
LQ Newbie
 
Registered: Dec 2010
Posts: 11

Original Poster
Rep: Reputation: 0
equivalent of iostat -E

Hi,
Thanks.....
what is the equivalent of iostat –E in linux ( it display all device error statics).
Linux which am using dosent support iostat -E
 
Old 12-09-2010, 12:21 AM   #14
prodev05
Member
 
Registered: Jul 2009
Location: Planet Earth
Distribution: Unix & Linux Variants
Posts: 304

Rep: Reputation: 20
The example script where shown is about functions in scripting. Here is one small example. Its very very simple and easy.

_____________________
#!/bin/bash

cat()
{
echo "I'm into cat"
}
cow()
{
echo "I'm into function cow"
}

cat
cow


exit 0

--------------------

reg

Happy Programming
 
Old 12-09-2010, 07:32 AM   #15
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by srrijith View Post
Hi,
Thanks.....
what is the equivalent of iostat –E in linux ( it display all device error statics).
Linux which am using dosent support iostat -E
You can look at the output of the "dmesg" command for errors, and you can also look in your system log.

Check the man pages for iostat and other utilities in the "sysstat" package.
 
  


Reply



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
script wrapper thread investmentbnker75 Programming 6 01-16-2010 11:48 PM
Wrapper script for alienBob's rsync_slackware_patches.sh ? Yalla-One Slackware 4 12-10-2009 07:18 AM
Bash: how to write a wrapper script? J_Szucs Programming 0 01-29-2005 05:50 PM
Wrapper needed for BASH Script outspoken Programming 0 01-12-2005 09:04 AM
server wrapper script yapp Programming 2 08-02-2003 11:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:36 AM.

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
Open Source Consulting | Domain Registration