diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2025-12-31 17:39:36 -0500 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2025-12-31 17:39:36 -0500 |
| commit | 99957c2e49121b616c61e483bf6ebc2271789a50 (patch) | |
| tree | 8ac8d97c400b0df61f4362868e1ae580509c7068 /readme.md | |
| download | svr-backups-99957c2e49121b616c61e483bf6ebc2271789a50.tar.gz svr-backups-99957c2e49121b616c61e483bf6ebc2271789a50.tar.xz | |
Diffstat (limited to 'readme.md')
| -rw-r--r-- | readme.md | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..2df285f --- /dev/null +++ b/readme.md @@ -0,0 +1,41 @@ +# Backup scripts + +Annoyed by complicated backup solutions, I've written my own simple scripts +to back up only what I care about in a format that's easily unpacked on a fresh +install of the system, that is, a tarball. There's no reason you couldn't +use `dump`, `btrfs send`, `zfs send` or similar, though and this script +supports handling that as long as you can pipe it over stdout and save to a file. + +Not for everyone, and I don't even use it for backups of my largest files, for +instance photos, videos, etc I use rclone and rsync instead of these scripts. + +## HOW TO + +Clone this repo down to the system that'll run the backups, set up a +ssh key in `ssh/id_ed25519` ( `ssh-keygen -t ed25519 -f ssh/id_ed25519` or so ) +and then set up your SSH config ( jump boxes, etc ) in `ssh/config` + +From there create a directory for each server that you're backing up, for +instance if I want to back up a server called `example.com`, `mkdir example.com`. + +From there, we need a script that will generate a tarball, examples can be +found in `openbsd.sh`, and `alpine.sh`, copy it to `example.com/backup.sh`, +and then `chmod +x` the file. This will be copied and then executed as root +on the remote machine. + +Another example worth calling out directly since it utilizes a slightly +different method, `alpine-diskless.sh` can be used to back up the config +using alpine's built in `lbu`, though it's worth passing in `-suffix tar.gz` +to the backup script. + + +Example crontab: + +``` +@monthly sh -c 'set -e;cd /home/backupdir;./backup.sh -type monthly -svr example.com' +@weekly sh -c 'set -e;cd /home/backupdir;./backup.sh -type weekly -svr example.com' +@daily sh -c 'set -e;cd /home/backupdir;./backup.sh -type daily -svr example.com' + +# Clean up the old backups daily, see the clean.sh for an example +@daily sh -c 'set -e;cd /home/backupdir;./clean.sh +``` |
