404.status-zfs revision 220017
1#!/bin/sh
2#
3# $FreeBSD: head/etc/periodic/daily/404.status-zfs 220017 2011-03-26 01:24:55Z dougb $
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	out=`zpool status -x`
20	echo "$out"
21	# zpool status -x always exits with 0, so we have to interpret its
22	# output to see what's going on.
23	if [ "$out" = "all pools are healthy" \
24	    -o "$out" = "no pools available" ]; then
25		rc=0
26	else
27		rc=1
28	fi
29	;;
30
31    *)
32	rc=0
33	;;
34esac
35
36exit $rc
37