]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - etc/periodic/daily/404.status-zfs
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / etc / periodic / daily / 404.status-zfs
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_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         ;;
43 esac
44
45 exit $rc