diff options
| author | Trey Bastian <hello@treybastian.com> | 2025-11-20 08:12:42 +0000 |
|---|---|---|
| committer | Trey Bastian <hello@treybastian.com> | 2025-11-20 08:12:42 +0000 |
| commit | ebee77682c7f18d08203c1d411c8c115c5fa21a9 (patch) | |
| tree | 4be271bbed1ee200f09a626a46486fe7ed16b680 | |
| parent | af49fd64a313816cb1a34ce3b70c20abcaaead4c (diff) | |
simplified
| -rwxr-xr-x | daily-snapshot.sh | 25 | ||||
| -rwxr-xr-x | hourly-backup.sh | 26 |
2 files changed, 0 insertions, 51 deletions
diff --git a/daily-snapshot.sh b/daily-snapshot.sh deleted file mode 100755 index 8a1544f..0000000 --- a/daily-snapshot.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -# This script will gzip /mnt/backup/live/ -# This script assumes /mnt/backup/snapshots/ is where we want to store archives -# This script will only keep 7 days worth of archives -# -- if you want to change this just change `MAX_BACKUPS` -# -# My personal setup: -# -- has this running daily with cron at 00:30z -# -- mounts /mnt/backup to it's own specific NFS share configured for the host -# - -MAX_BACKUPS=7 - -tar -czf "/mnt/backup/snapshots/gwaine.snapshot.`date -Iseconds`.tar.gz" -C /mnt/backup/live . - -COUNT=$(ls -1 /mnt/backup/snapshots/*.tar.gz 2>/dev/null | wc -l) - -if [ "$COUNT" -gt $MAX_BACKUPS]; then - # why not just delete the oldest file only Trey??? - # well I'll tell you why! If I want to change MAX_BACKUPS from 7 to 3 - # I'll have a whole bunch of extra archives I don't want to keep - EXTRA=$((COUNT - MAX_BACKUPS)) - ls -1T /mnt/backup/snapshots/*.tar.gz | tail -n "$EXTRA" | xargs rm -f -fi diff --git a/hourly-backup.sh b/hourly-backup.sh deleted file mode 100755 index c301448..0000000 --- a/hourly-backup.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# -# This script will rsync the entire filesystem to /mnt/backup/live/ -# This script assumes /mnt/backup/live/ is where we want to backup files -# -# My personal setup: -# -- has this running hourly with cron -# -- mounts /mnt/backup to it's own specific NFS share configured for the host -# -# !! WARNING SLOW FIRST RUN !! -# the first run will be slow so run this first before setting up the hourly job - -rsync -aAXH \ - --exclude /dev/ \ - --exclude /proc/ \ - --exclude /sys/ \ - --exclude /tmp/ \ - --exclude /usr/tmp/ \ - --exclude /run/ \ - --exclude /mnt/ \ - --exclude /media/ \ - --exclude /var/cache/ \ - --exclude lost+found/ \ - --exclude /var/log/journal \ - --exclude /var/lib/systemd/random-seed - /* /mnt/backup/live/ --delete |
