zb-cleanup: density calculation fix

This commit is contained in:
Mirek Kratochvil 2014-06-05 20:37:28 +02:00
parent 42aaa74de1
commit be5802b120

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
if [[ -z "$1" || -z "$2" ]] ; then if [[ -z "$1" || -z "$2" ]] ; then
echo "usage: $0 <zfs_object> <density>" >&2 echo "usage: $0 <zfs_object> <density_percent>" >&2
exit 1 exit 1
fi fi
@ -30,7 +30,7 @@ done |sort -n | while read l ; do
fi fi
#if it's too dense, delete the closer snapshot #if it's too dense, delete the closer snapshot
if [ $(( $density*($curtime-$lasttime)/($timenow-$lasttime) )) -lt 1] if [ $(( $density*($curtime-$lasttime)/($timenow-$lasttime) )) -lt 100 ]
then then
zfs destroy "$snapname" zfs destroy "$snapname"
else else