xref: /freebsd/usr.sbin/periodic/etc/daily/404.status-zfs (revision 36712a94975f5bd0d26c85377283b49a2369c82f)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6# If there is a global system configuration file, suck it in.
7#
8if [ -r /etc/defaults/periodic.conf ]
9then
10    . /etc/defaults/periodic.conf
11    source_periodic_confs
12fi
13
14case "$daily_status_zfs_enable" in
15    [Yy][Ee][Ss])
16	echo
17	echo 'Checking status of zfs pools:'
18
19	case "$daily_status_zfs_zpool_list_enable" in
20	    [Yy][Ee][Ss])
21		lout=`zpool list`
22		echo "$lout"
23		echo
24		;;
25	    *)
26		;;
27	esac
28	sout=`zpool status -x`
29	echo "$sout"
30	# zpool status -x always exits with 0, so we have to interpret its
31	# output to see what's going on.
32	if [ "$sout" = "all pools are healthy" \
33	    -o "$sout" = "no pools available" ]; then
34		rc=0
35	else
36		rc=1
37	fi
38	;;
39
40    *)
41	rc=0
42	;;
43esac
44
45exit $rc
46