mirror of
https://github.com/turtlebasket/michaelnet.git
synced 2026-03-04 19:44:31 -08:00
backup host + tweaks
This commit is contained in:
24
backup/README.md
Normal file
24
backup/README.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Generic Backup Host
|
||||
|
||||
## Filenames
|
||||
|
||||
Container volume backups are of the format:
|
||||
|
||||
```
|
||||
gitea-data-2023-06-17_050002.tar.gz.enc
|
||||
^ ^ ^
|
||||
| | Backups are encrypted tarballs
|
||||
| |
|
||||
| ISO Datetime separated by _
|
||||
|
|
||||
Container volume name (*-data)
|
||||
```
|
||||
|
||||
## Matching
|
||||
|
||||
Regex to match backups that are *not* from the first of every month:
|
||||
|
||||
```
|
||||
.*-data-\d{4}-\d{2}-([^0][0-9]|[0-9][^1])_.*
|
||||
```
|
||||
|
||||
15
backup/prune.sh
Normal file
15
backup/prune.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
# Prunes container data folders monthly on backup host
|
||||
# - Regex has been tested and works
|
||||
# - Script is not yet tested
|
||||
|
||||
ARCHIVES=$(ls | grep -E "[0-9A-Za-z]+-data-\d{4}-\d{2}-([^0][0-9]|[0-9][^1])_.*")
|
||||
|
||||
for archive in $ARCHIVES; do
|
||||
if [ -d $archive ]; then
|
||||
echo "Removing $archive"
|
||||
rm -f $archive
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user