fi
}
-# Input vars: $vol $root_dir (from get-btrfs-root-mountpoint)
+# Input vars: $vol, PWD=$root_dir (from get-btrfs-root-mountpoint)
expire-leaf-vols() {
local leaf_vols count leaf_limit_time leaf_new_limit_time leaf
- leaf_vols=($root_dir/$vol.leaf.*)
+ leaf_vols=($vol.leaf.*)
count=${#leaf_vols[@]}
leaf_limit_time=$(( EPOCHSECONDS - 60*60*24*60 )) # 60 days
leaf_new_limit_time=$(( EPOCHSECONDS - 60*60*24 * 5 )) # 5 days
# This goes backwards from oldest. leaf_new_limit_time is to avoid
# deleting very recent leafs.
for leaf in ${leaf_vols[@]}; do
- leaf_time=$(date -d ${leaf##"$vol".leaf.} +%s)
+ leaf_time=$(date -d ${leaf#$vol.leaf.} +%s)
if (( leaf_limit_time > leaf_time || ( leaf_new_limit_time > leaf_time && count > 30 ) )); then
b btrfs sub del $leaf
fi
to_umount=($dir)
fi
done
- umount-dirs-add ${binds[@]} $d
else
mnt $d ${binds[@]}
fi