1827809 Members
2035 Online
109969 Solutions
New Discussion

Re: Script

 
Anjaneyulu
Frequent Advisor

Script

Hi,

Please give me the instructions to write the script. I want to moniter the how much data is read and write per second for 3 days every hour that report is send to /tmp.
10 REPLIES 10
Mark McDonald_2
Trusted Contributor

Re: Script

Hello,

->Please give me the instructions to write the script.

Use vi?
start with something like
#!/usr/bin/ksh
.
.
.

->I want to moniter the how much data is read and write per second for 3 days every hour that report is send to /tmp.

How much unix do you know? Have you attempted something that we can edit for you?

have a look at
#man iostat
Does this provide the info you need?

This can dump stats every 3 seconds for an hour. If this is kicked off from cron on an hourly basis, outputting to a tmp file. Each hour, when the script is started it should generate a new output file name, based on date and hour number.

Good luck
Mark
Anjaneyulu
Frequent Advisor

Re: Script

I want per logical volume of the perticolar vg . that lv is located in mount point is /dba

If you have any script please send me.
Anjaneyulu
Frequent Advisor

Re: Script

I will explain clearly in /db/tmpdb/tpdata is a file. This file is write the data in lv01. I want to write the script howmuch data is write into the lv of this file.
Mark McDonald_2
Trusted Contributor

Re: Script

Sorry - I do not have a script.

You could run

FS=/db/tmp/db <- mount point
bdf /$FS then grep or awk out the size.

run this every 3 seconds in a loop and check the size differences. Is that what you are looking for?

Mark
Mark McDonald_2
Trusted Contributor

Re: Script


Put this in a loop:

OLDSIZE=$SIZE
SIZE=$(bdf /tmp | grep -v kbytes | awk '{ print $3 }')

then report OLDSIZE - SIZE
Anjaneyulu
Frequent Advisor

Re: Script

Hi,

#!/bin/sh
OLDSIZE=$SIZE
SIZE=$(bdf /tmp | grep -v kbytes | awk '{ print $3 }')


it's not executed. please give me the advice. How to execute.
Anjaneyulu
Frequent Advisor

Re: Script

Hi,

How can I execute the script per every 3 minutes in cronjab.

How can i give the entry in the crontab file.
Mark McDonald_2
Trusted Contributor

Re: Script

you can add
echo $OLDSIZE $SIZE

But you will have to do some arithmetic aswell if you want the differences.

cron entry:

0,3,6,9,12,15,18,...,54,57 * * * * /path/script >> /tmp/output

fill in the ... with the other miutes.
Mark McDonald_2
Trusted Contributor

Re: Script

Sorry forgot to add:

to edit the crontab file use
crontab -e

you may need to:
EDITOR=vi
export EDITOR

before the crontab -e depending on what your edit is set to.

Also if you are not running as root, you may need an entry in /etc/cron.allow
Mark McDonald_2
Trusted Contributor

Re: Script

Just reading through your posts again:
-> it's not executed. please give me the advice. How to execute.

once you have created and saved the script, you need to set the execute bits in the permissions.

eg: chmod 700 filename

This will give the file read write and execute permissions for the owner. (-rwx------ permissions)