root / bin / zpool-get-state @ 67
Historique | Voir | Annoter | Télécharger (858 octet)
1 |
#!/bin/bash |
---|---|
2 |
# $Id: zpool-get-state 51 2013-10-10 11:20:37Z ltaulell $ |
3 |
# Copyright (C) 2013 Kevin Reverchon, Loïs Taulelle |
4 |
# This file/program is part of gZFS free software |
5 |
# See COPYING file for details |
6 |
# |
7 |
|
8 |
BINZFS="/sbin/zfs" |
9 |
BINZPOOL="/sbin/zpool" |
10 |
|
11 |
function usage { |
12 |
|
13 |
echo "Syntax :" |
14 |
echo "$0 -n zpool_name : display zpool state and last scrub" |
15 |
echo "$0 -h : display this message" |
16 |
} |
17 |
function nointeractive { |
18 |
echo $($BINZPOOL status $poolname|grep -i "state:"|sed -e "s/^ \+//g"|sed -e "s/: /:/") |
19 |
echo $($BINZPOOL status $poolname|grep -i "scan:"|sed -e "s/^ \+//g"|sed -e "s/: /:/") |
20 |
exit 0 |
21 |
} |
22 |
while getopts "in:h" OPTION |
23 |
do |
24 |
case $OPTION in |
25 |
h) |
26 |
usage |
27 |
exit 1 |
28 |
;; |
29 |
n) |
30 |
poolname=$OPTARG |
31 |
;; |
32 |
*) |
33 |
usage |
34 |
;; |
35 |
esac |
36 |
done |
37 |
if [[ -z $poolname ]] |
38 |
then |
39 |
usage |
40 |
exit 1 |
41 |
fi |
42 |
|
43 |
nointeractive |
44 |
|
45 |
|