xref: /freebsd/usr.sbin/periodic/etc/daily/401.status-graid (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1*81ea85a8SBrad Davis#!/bin/sh
2*81ea85a8SBrad Davis#
3*81ea85a8SBrad Davis#
4*81ea85a8SBrad Davis
5*81ea85a8SBrad Davis# If there is a global system configuration file, suck it in.
6*81ea85a8SBrad Davis#
7*81ea85a8SBrad Davisif [ -r /etc/defaults/periodic.conf ]
8*81ea85a8SBrad Davisthen
9*81ea85a8SBrad Davis    . /etc/defaults/periodic.conf
10*81ea85a8SBrad Davis    source_periodic_confs
11*81ea85a8SBrad Davisfi
12*81ea85a8SBrad Davis
13*81ea85a8SBrad Daviscase "$daily_status_graid_enable" in
14*81ea85a8SBrad Davis    [Yy][Ee][Ss])
15*81ea85a8SBrad Davis	echo
16*81ea85a8SBrad Davis	echo 'Checking status of graid(8) devices:'
17*81ea85a8SBrad Davis
18*81ea85a8SBrad Davis	if graid status; then
19*81ea85a8SBrad Davis		components="$(graid status -s | fgrep -v OPTIMAL)"
20*81ea85a8SBrad Davis		if [ "${components}" ]; then
21*81ea85a8SBrad Davis			rc=3
22*81ea85a8SBrad Davis		else
23*81ea85a8SBrad Davis			rc=0
24*81ea85a8SBrad Davis		fi
25*81ea85a8SBrad Davis	else
26*81ea85a8SBrad Davis		rc=2
27*81ea85a8SBrad Davis	fi
28*81ea85a8SBrad Davis	;;
29*81ea85a8SBrad Davis
30*81ea85a8SBrad Davis    *)  rc=0;;
31*81ea85a8SBrad Davisesac
32*81ea85a8SBrad Davis
33*81ea85a8SBrad Davisexit $rc
34