Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have configured RAID1(software raid). And since I am newbie in shell scripting, I need shell script to send mail when any of the raid array get fails. It would be very appreciated if anybody already having the script and post it here. or please help me, how can I cut "[" "]" from the below command's output. The raid status is stored in mdstat file.
Notice your field is now $2 in the first awk because it is no longer delimited by white space and the "UU]" is the second thing after the "[" delimiter. Similarly in the second awk the field is $1 because "UU" is the first thing before the "]" delimiter.
You could perhaps simplify the above by using sed the command rather than dual awks.
Working fine, But it is not showing as RAID FAILED while $status is U_ or UF or only U in any of the raid array. For example cat /proc/mdstat output is saved in a file and changed the md4 status from "UU" to "U_", Please see the below example
Thank you very much chrism01,
Sorry for the late response. Could you please help me to print failed devices using awk/sed? For example
Personalities : [raid1]
md0 : active raid1 sdb1 sda1
1020032 blocks [2/2] [__]
md2 : active raid1 sdb3 sda3
20482752 blocks [2/2] [UU]
md3 : active raid1 sdb5 sda5
537117056 blocks [2/2] [UF]
md4 : active raid1 sdb6 sda6
315741376 blocks [2/2] [UU]
md5 : active raid1 sdd1 sdc1
976759936 blocks [2/2] [_U]
md1 : active raid1 sdb2 sda2
102398208 blocks [2/2] [U_]
unused devices: <none>
Here I want to print out only failed devices which are in red color. So it would be appreciated if you post the awk or sed commands to print only failed device and by excluding those raid array which are good i.e UU.
Last edited by niharikaananth; 02-22-2012 at 10:17 AM.