metastat error information send to mail script


 
Thread Tools Search this Thread
Operating Systems Solaris metastat error information send to mail script
# 1  
Old 06-24-2008
metastat error information send to mail script

Hi frnds,

I want excute the command through shell script.

command is #metastat
once u excute this cmd we will get some information on raid configuration status.
Once it is working properly we will get status 'okey' otherwise will get status 'error'.

i want to script for
once we get status 'error', it should send to my mail id.
Please..itz very urgent for me.

Adv. Thanks
Arjunreddy
# 2  
Old 06-24-2008
capture the output of metastat command in a file.
grep for 'error' in the file, and if found, then send an e-mail with the file attached
# 3  
Old 06-24-2008
# metastat
d10: RAID
State: Okay
Interlace: 32 blocks
Size: 10080 blocks
Original device:
Size: 10496 blocks
Device Start Block Dbase State Hot Spare
c0t0d0s1 330 No Okay
c1t2d0s1 330 No Okay
c2t3d0s1 330 No Okay

once if u get status okey no problem.

# metastat
d10: RAID
State: error
Interlace: 32 blocks
Size: 10080 blocks
Original device:
Size: 10496 blocks
Device Start Block Dbase State Hot Spare
c0t0d0s1 330 No error
c1t2d0s1 330 No error
c2t3d0s1 330 No error

once if you get like this type of error ststus,
it should send to my mail id. that is xxxx@gmail.com

adv.thanks
Arjun reddy
# 4  
Old 06-24-2008
I have not tested the syntax, but should be something like this:

#!/bin/ksh
meta=`metastat > /var/tmp/meta.out`
output=`cat /var/tmp/meta.out |grep State | awk '{print $2}'`

if [ ${output} != Okay ];then
mailx -s "Attention: Disk Error" "xxx@gmail.com" << ${meta}

Last edited by incredible; 06-24-2008 at 07:26 AM..
# 5  
Old 06-25-2008
hi,
i check that script.itz not working...any other script?
# 6  
Old 06-25-2008
As I've told you, its not tested. You have to make customizations to it . I will see if I get the time
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies

2. Shell Programming and Scripting

A shell script to run a script which don't get terminated and send a pattern from the output by mail

Hi Guys, I am very new to shell script and I need your help here to write a script. Actually, I have a script abc.sh which don't get terminated itself. So I need to design a script to run this script, save the output to a file, search for a given string in the output and if it exists send those... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies

3. Shell Programming and Scripting

Need Script to ZIP/SAVE & then DELETE Log file & send a mail conformation for any error

ENVIROMENT Linux: RHEL 6.4 Log Path: /usr/iplanet/servers/https-company/logs Log Format: user.log.03-15-2015 I have log4j log rotation enabled rotating files on a daily basis. The rotated logs are NOT compressed & are taking up too much space. I need a script that will run daily that... (1 Reply)
Discussion started by: admin_job_admin
1 Replies

4. Linux

Send-mail: fatal error

Hi guys, i am using the below command to send mail mail -s "HI" abcd@how.com < temp_mail.txt I am getting the below error send-mail: fatal: bad string length 0 < 1: myorigin = My os version is as Linux Help me with ur suggestion guys thank u. (3 Replies)
Discussion started by: mohanalakshmi
3 Replies

5. Shell Programming and Scripting

Error in send mail command

Hi, I am getting the following error while running send mail command from a shell script? Insufficient disk space; try again later How to handle this error? (1 Reply)
Discussion started by: AhmedLakadkutta
1 Replies

6. Shell Programming and Scripting

script to send mail !!

Hi Experts.. i have created a table with the fields, empid name mailid 1 raja raja@xy.com and entered the values of all persons who are in that file... i have a .csv file date shift1 shift2 6/6/2011 ram raja Now i want a script that could fetch the data in (input file .csv file) and... (3 Replies)
Discussion started by: cratercrabs
3 Replies

7. Shell Programming and Scripting

Help-send mail script

Hi, I have written one script for sending mails with attachment. currently its working for only one recipient. I want to send mails to n number of users by taking user input i.e number of users. Output of current script: Enter how many files : 1 Enter First Name : kiran E-Mail... (2 Replies)
Discussion started by: kiran_j
2 Replies

8. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

9. Shell Programming and Scripting

Calling SQL script from ksh job and send mail on some error.

Hi, I am trying to call sql script from ksh job with parameters.The parameters passed from ksh job will be used in SELECT query in sql file to SPOOL the data in extract file.My questions are: 1) How to call a sql script from ksh job with parameters? 2) How to use the parameter in sql file to... (1 Reply)
Discussion started by: anil029
1 Replies

10. Shell Programming and Scripting

Shell script to send a mail

Hi , I need to prepare a script which will check my database with specific to particluar table. If the row count exceeds a certain limit, i need to send a mail to a set of Recipients. Being new to unix, please guide me to complete this task. Advance thanks, Sekar. (4 Replies)
Discussion started by: Sekar1
4 Replies
Login or Register to Ask a Question