vern-scripts/tilserv/delbackup

8 lines
244 B
Bash
Executable File

#!/usr/bin/env -S bash -e
for i in $(zfs list -H -o name -t snapshot | grep 'bighdd\/backup\/.*@2.*'); do
if (( date - ${i##bighdd*@} >= 7 )); then
echo "$i is to be deleted since the snapshot is 7 days or older"
zfs destroy ${i}
fi
done