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