Skip to content
Snippets Groups Projects
Commit e4a1b855 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Use bc instead of expr for calculations. Fix bogus path.

parent 4b39a669
Branches
No related tags found
No related merge requests found
#!/bin/sh #!/bin/sh
PATH=/usr/sbin:bin PATH=/usr/sbin:/bin
export PATH export PATH
if [ $# -ne 1 ] if [ $# -ne 1 ]
...@@ -16,10 +16,10 @@ size=`zpool list -H -o size $POOL` ...@@ -16,10 +16,10 @@ size=`zpool list -H -o size $POOL`
avail=`zpool list -H -o available $POOL` avail=`zpool list -H -o available $POOL`
bytes () { bytes () {
echo $1 | sed -e 's/G/ * 1024M/' -e 's/M/ * 1024K/' -e 's/K/ * 1024/' | xargs expr echo $1 | sed -e 's/G/ * 1024M/' -e 's/M/ * 1024K/' -e 's/K/ * 1024/' | bc
} }
capacity=`expr 100 - 100 '*' \`bytes $avail\` / \`bytes $size\`` capacity=`echo 100 - 100 '*' \`bytes $avail\` / \`bytes $size\` | bc`
if [ x"$health" != xONLINE ] if [ x"$health" != xONLINE ]
then then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment