2023-06-25 09:25:32 -07:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
2023-07-27 23:45:33 -07:00
|
|
|
# Prunes container data folders monthly on backup host.
|
|
|
|
# Removes all items but the backup from the first day of the month.
|
|
|
|
# Should run on the first day of every month - since it doesn't remove the backup
|
|
|
|
# from that time, it doesn't matter what time it's run
|
|
|
|
|
|
|
|
for item in *; do
|
|
|
|
if [[ "$item" =~ [0-9A-Za-z]+-data-[0-9]{4}-[0-9]{2}-([^0][0-9]|[0-9][^1])_.* ]]; then
|
|
|
|
echo "Removing $item"
|
|
|
|
rm -f $item
|
2023-06-25 09:25:32 -07:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|