HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Getting mdadm to run specified program
Operating System - Linux
1826317
Members
4014
Online
109692
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2007 06:50 PM
02-22-2007 06:50 PM
Hi
I have a DL145G2 running software RAID. OS is Red Hat Enterprise Linux ES release 4 (Nahant Update 3)
I want mdadm to run a program whenever a disk event occurs.
This is my mdadm.conf settings
---------------------------
DEVICE partitions
MAILADDR root
PROGRAM /opt/mdmon/handle-mdadm-events
ARRAY /dev/md1 super-minor=1
ARRAY /dev/md0 super-minor=0
ARRAY /dev/md2 super-minor=2
ARRAY /dev/md3 super-minor=3
ARRAY /dev/md4 super-minor=4
-------------------------
I modified the following line in /etc/init.d/mdmonitor
"/bin/bash -c \"mdadm --monitor --scan -f > /var/run/mdadm/mdadm.pid\""
to
"/bin/bash -c \"mdadm --monitor --scan -f -t > /var/run/mdadm/mdadm.pid\""
Purpose is to generate test message at startup.
I restart mdadm using
# /etc/init.d/mdmonitor restart
As expected, an email message is sent to root but the program /opt/mdmon/handle-mdadm-events fails to execute.
Contents of program
/bin/echo "TEST" >> /opt/mdmon/test.log
The file /opt/mdmon/test.log is not generated at all. What could have gone wrong?
The execute bit of the program is already set.
I have a DL145G2 running software RAID. OS is Red Hat Enterprise Linux ES release 4 (Nahant Update 3)
I want mdadm to run a program whenever a disk event occurs.
This is my mdadm.conf settings
---------------------------
DEVICE partitions
MAILADDR root
PROGRAM /opt/mdmon/handle-mdadm-events
ARRAY /dev/md1 super-minor=1
ARRAY /dev/md0 super-minor=0
ARRAY /dev/md2 super-minor=2
ARRAY /dev/md3 super-minor=3
ARRAY /dev/md4 super-minor=4
-------------------------
I modified the following line in /etc/init.d/mdmonitor
"/bin/bash -c \"mdadm --monitor --scan -f > /var/run/mdadm/mdadm.pid\""
to
"/bin/bash -c \"mdadm --monitor --scan -f -t > /var/run/mdadm/mdadm.pid\""
Purpose is to generate test message at startup.
I restart mdadm using
# /etc/init.d/mdmonitor restart
As expected, an email message is sent to root but the program /opt/mdmon/handle-mdadm-events fails to execute.
Contents of program
/bin/echo "TEST" >> /opt/mdmon/test.log
The file /opt/mdmon/test.log is not generated at all. What could have gone wrong?
The execute bit of the program is already set.
All Your Bases Are Belong To Us!
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2007 09:59 PM
02-22-2007 09:59 PM
Solution
Can you run the script manually ?
I would anyway recommend some 'minimal' things in your script:
-----
#!/bin/bash
/bin/echo "TEST" >> /opt/mdmon/test.log
exit 0
-----
Kind of a safety net: the 1st line denotes how to interpret the script; the last one does a clean exit -and- prevents any control characters at the end of your file to mess things up.
(not at my linux machines right now so I can't recreate your situation for now, sorry)
Cheers,
Wout
I would anyway recommend some 'minimal' things in your script:
-----
#!/bin/bash
/bin/echo "TEST" >> /opt/mdmon/test.log
exit 0
-----
Kind of a safety net: the 1st line denotes how to interpret the script; the last one does a clean exit -and- prevents any control characters at the end of your file to mess things up.
(not at my linux machines right now so I can't recreate your situation for now, sorry)
Cheers,
Wout
an engineer's aim in a discussion is not to persuade, but to clarify.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2007 11:59 AM
02-25-2007 11:59 AM
Re: Getting mdadm to run specified program
Adding the line
#!/bin/bash
solved the problem. Thanks!
#!/bin/bash
solved the problem. Thanks!
All Your Bases Are Belong To Us!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP