Statistiques
| Révision :

root / bin / zpool-get-state @ 2

Historique | Voir | Annoter | Télécharger (665 octet)

1
#!/bin/bash
2

    
3

    
4
function usage {
5

    
6
  echo "Syntax :"
7
  echo "$0 -n zpool_name : display zpool state and last scrub"
8
  echo "$0 -h : display this message"
9
}
10
function nointeractive {
11
  echo $(zpool status $poolname|grep -i "state:"|sed -e "s/^ \+//g"|sed -e "s/: /:/")
12
  echo $(zpool status $poolname|grep -i "scan:"|sed -e "s/^ \+//g"|sed -e "s/: /:/")
13
  exit 0
14
}
15
while getopts "in:h" OPTION
16
do
17
     case $OPTION in
18
         h)
19
             usage
20
             exit 1
21
             ;;
22
         n)
23
            poolname=$OPTARG
24
            ;;
25
         *)
26
            usage
27
            ;;
28
     esac
29
done
30
if [[ -z $poolname ]]
31
then
32
     usage
33
     exit 1
34
fi
35

    
36
nointeractive
37

    
38