]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - etc/periodic/daily/405.status-ata-raid
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / etc / periodic / daily / 405.status-ata-raid
1 #!/bin/sh
2 #
3 # $FreeBSD$
4 #
5
6 # If there is a global system configuration file, suck it in.
7 #
8 if [ -r /etc/defaults/periodic.conf ]
9 then
10     . /etc/defaults/periodic.conf
11     source_periodic_confs
12 fi
13
14 case "$daily_status_ata_raid_enable" in
15     [Yy][Ee][Ss])
16         echo
17         echo 'Checking status of ATA raid partitions:'
18
19         rc=0
20         for raid in `find /dev/ -name 'ar[0-9]*' -type c | egrep '[0-9]$' \
21                 | egrep -v 's[0-9]' | cut -d / -f 3`
22              do
23                 status=`/sbin/atacontrol status $raid`
24                 echo $status
25                 raid_rc=`echo $status | grep -v READY | wc -l`
26                 [ $rc -eq 0 ] && [ $raid_rc -gt 0 ] && rc=3
27              done
28         ;;
29
30     *)  rc=0;;
31 esac
32
33 exit $rc