LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-14-2017, 02:59 AM   #1
diosim
LQ Newbie
 
Registered: Jun 2017
Posts: 16

Rep: Reputation: Disabled
Ledctl and mdadm


Morning everyone,

I'm testing a JBOD storage with mdadm monitor and set LED's depending events output from mdadm via a script as below:

Code:
#!/bin/bash

event=$1
device=$3

case "$event" in
 "Fail")
  ledctl disk_failed=/dev/$device
;;
"RebuildStarted")
  ledctl rebuild=/dev/$device
;;
 "RebuildFinished")
  ledctl normal=/dev/$device
;;
 "SpareActive")
  ledctl normal=/dev/$device
;;q
esac
exit 0
The issue is that after disk has been rebuild, ledctl is complaining about this:
Code:
md: md0: resync done.
ledctl: /dev/: device not supported
ledctl: mismatches - unknown pattern name.
Do you know what could be the issue?
I'm using Centos.
Thanks

Last edited by diosim; 06-14-2017 at 06:37 AM. Reason: adding [code][/code]
 
Old 06-14-2017, 06:25 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,355
Blog Entries: 13

Rep: Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411
Hi diosim and welcome to LQ.

Please use [code][/code] tags around any code or output next time so it can be more readable and the formatting of it is retained.

The issue appears to be that the variable $device has nothing in it.

What arguments are you calling this script with? What are you doing, if anything, with the second argument, which would be treated as $2?

I persistently recommend people add some debug by adding a set -xv line near the top of their script, example:
Code:
#!/bin/bash
set -xv
This will show you additional details and for things like where you set up your variables, it will output what has happened in the script.
 
Old 06-14-2017, 06:42 AM   #3
diosim
LQ Newbie
 
Registered: Jun 2017
Posts: 16

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rtmistler View Post
Hi diosim and welcome to LQ.

Please use [code][/code] tags around any code or output next time so it can be more readable and the formatting of it is retained.

The issue appears to be that the variable $device has nothing in it.

What arguments are you calling this script with? What are you doing, if anything, with the second argument, which would be treated as $2?

I persistently recommend people add some debug by adding a set -xv line near the top of their script, example:
Code:
#!/bin/bash
set -xv
This will show you additional details and for things like where you set up your variables, it will output what has happened in the script.
Sorry about that, I just edited it.
In fact, I'm using arguments called by mdadm, as below (https://linux.die.net/man/8/mdadm), so $device is the first argument which is a disk.

When passing events to a program, the program is run once for each event, and is given 2 or 3 command-line arguments: the first is the name of the event (see below), the second is the name of the md device which is affected, and the third is the name of a related device if relevant (such as a component device that has failed).
 
Old 06-14-2017, 06:49 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,355
Blog Entries: 13

Rep: Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411Reputation: 4411
Thank you for the edit and the additional explanation. My earlier point is that the $device variable seems to have been cleared, or never have been set up. From what I can see, it would tentatively be set up by the third passing argument for the script, $3. If you echo both $3 as well as $device, after it has been set, you can verify what these values are and that they are correct, versus not. Or if you use the "set -xv" method, you should see enough debug output when you run the script to inform you of what is happening.

The reason I feel this is the following output you posted:
Code:
ledctl: /dev/: device not supported
This is telling me that there is nothing in $device, otherwise as an example, say it had an invalid name in the $device variable, like the word "frank". i.e. device=frank, then that error I feel would say something like:
Code:
ledctl: /dev/frank: device not supported
 
Old 06-15-2017, 06:24 AM   #5
diosim
LQ Newbie
 
Registered: Jun 2017
Posts: 16

Original Poster
Rep: Reputation: Disabled
Thanks for your help, it appears that it was just an issue about ledctl pattern, using SES-2 protocol, fixed the issue.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to backup MDADM super blocks and other tips I should know about mdadm? road hazard Linux - Newbie 5 08-04-2016 12:21 AM
[SOLVED] Attempts to work around a mdadm bug/ mdadm cannot get exclusive access to /dev/md127 Sereph Linux - Newbie 1 08-16-2011 03:21 AM
MDADM screws up the LVM partitions? Can't mount the LVMs after mdadm stopped alirezan1 Linux - Newbie 3 11-18-2008 04:42 PM
unable to load MDADM module BUT mdadm works?!?!?! alirezan1 Linux - Software 2 09-08-2008 07:58 PM
mdadm says "mdadm: /dev/md1 not identified in config file" when booting FC7 raffeD Linux - Server 1 08-11-2008 11:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:24 PM.

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