parag joshi

Well-Known Member
Sep 2, 2008
52
0
56
Hello,

How to create cron job software raid one and email should come to us?

Please advise.
 

Lyttek

Well-Known Member
Jan 2, 2004
776
4
168
What??

You want to create a cron job, it emails the results of the status of a raid array? Or ??


Code:
#!/bin/sh

# Email mdadm status

for i in '/dev/md0 /dev/md1 /dev/md2 /dev/md3'
do
/sbin/mdadm --detail $i > /customscripts/raid-report.txt
done

mail -s "raid report" [email protected] < /customscripts/raid-report.txt
This script takes a space-separated list of md (raid) devices, runs a report, plunks in a txt file and then emails it.


(I tried to make it cleaner by setting the list to 'md0 md1 md2 md3' and the using /sbin/mdadm --detail /dev/$i but it only processes the first element, and errors out on the rest... unsure why)
 
Last edited: