Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for b in 512 256 128 64 32 16 8 4; do
- let a=b/2+1
- let f=0 #this flag is set to 1 when we find the 1st snapshot in the range b..a
- for i in $(seq -f'%03g' "${b}" -1 "${a}"); do
- if [ -d "${SNAPSHOT_DST}/${HOST_SRC}/${NAME}.${i}" ]; then
- if [ "${f}" -eq 0 ]; then
- let f=1
- else
- echo "$(date +%Y-%m-%d_%H:%M:%S) Removing ${SNAPSHOT_DST}/${HOST_SRC}/${NAME}.${i} ..."
- [ "${CHATTR}" -eq 1 ] && chattr -R -i "${SNAPSHOT_DST}/${HOST_SRC}/${NAME}.${i}" &>/dev/null
- rm -rf "${SNAPSHOT_DST}/${HOST_SRC}/${NAME}.${i}"
- fi
- fi
- done
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement