3 NAME="cciss-vol-statusd"
4 STATUSFILE=/var/run/$NAME.status
6 # Do not touch you can configure this in /etc/default/cciss-vol-statusd
7 MAILTO=root # Where to report problems
8 PERIOD=600 # Seconds between each check (default 10 minutes)
9 REMIND=7200 # Seconds between each reminder (default 2 hours)
12 [ -e /etc/default/cciss-vol-statusd ] && . /etc/default/cciss-vol-statusd
14 # Gracefully exit if the package has been removed.
15 test -x /usr/bin/cciss_vol_status || exit 0
18 # Check ever $PERIOD seconds, send email on every status
19 # change and repeat ever $REMIND seconds if the raid is still
21 if (cciss_vol_status $ID); then
25 logger -t cciss-vol-statusd "detected non-optimal RAID status"
28 if [ true = "$BADRAID" ] ; then
30 (cciss_vol_status $ID) > $STATUSFILE.new
31 if [ ! -f $STATUSFILE ] ; then # RAID just became broken
33 mv $STATUSFILE.new $STATUSFILE
34 elif cmp -s $STATUSFILE $STATUSFILE.new ; then
35 # No change. Should we send reminder?
36 LASTTIME="`stat -c '%Z' $STATUSFILE`"
38 SINCELAST="`expr $NOW - $LASTTIME`"
39 if [ $REMIND -le "$SINCELAST" ]; then
40 # Time to send reminder
42 mv $STATUSFILE.new $STATUSFILE
48 mv $STATUSFILE.new $STATUSFILE
52 if [ -f $STATUSFILE ] ; then
58 if [ true = "$STATUSCHANGE" ]; then
62 This is a RAID status update from cciss-vol-statusd. The cciss_vol_status
63 program reports that one of the RAIDs changed state:
66 if [ -f $STATUSFILE ] ; then
69 (cciss_vol_status $ID)
72 echo "Report from $0 on $hostname"
73 ) | mail -s "info: CCISS raid status change on $hostname" $MAILTO