L'état d'un RAID logiciel Linux résumé par courriel

Voilà un petit script très simple pour recevoir automatiquement par courriel l'état d'un RAID logiciel sous Linux :

#!/bin/sh
# cron.weekly/mdadm-status -- weekly status of the RAID
# 2013 Pierre-Alain Bandinelli
# distributed under the terms of the Artistic Licence 2.0

# Get status from the RAID array and send the details by email.
# Email will go to the address specified in the commandline.
set -eu

MDADM=/sbin/mdadm
[ -x $MDADM ] || exit 0 # package may be removed but not purged

DEST="administrateur@cestmoi.fr"
exec $MDADM --detail /dev/md0 /dev/md1 /dev/md2 |mail -s "RAID status" $DEST

On peut placer ce script dans cron.weekly pour recevoir ces informations manière hebdomadaire par exemple.

Longue vie à votre RAID !