From 44f06753fa7aeddb4735fbd91fe9e4fd6d5a3eca Mon Sep 17 00:00:00 2001 From: albert Date: Mon, 16 Dec 2024 02:56:39 +0100 Subject: [PATCH] Update btrfs-backup script --- nixos/common/software/cli/scripts/btrfs-backup.sh | 4 ++-- nixos/hosts/nixos-framework/disks.nix | 9 +++++++++ wallpapers | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/nixos/common/software/cli/scripts/btrfs-backup.sh b/nixos/common/software/cli/scripts/btrfs-backup.sh index a9813f61..a9c19960 100755 --- a/nixos/common/software/cli/scripts/btrfs-backup.sh +++ b/nixos/common/software/cli/scripts/btrfs-backup.sh @@ -122,7 +122,7 @@ if [ -z "$LAST_TRANSFERRED" ]; then sudo btrfs send "$SNAPSHOT_PATH/$LATEST_SNAPSHOT/snapshot" | \ pv --bytes | \ ssh "$REMOTE_HOST" "btrfs receive '$DEST_PATH'" && { - sudo echo "$LATEST_SNAPSHOT" > "$STATE_FILE" + sudo echo "$LATEST_SNAPSHOT" | sudo tee "$STATE_FILE" log "Full send completed successfully" } || { log "ERROR: Full send failed" @@ -135,7 +135,7 @@ else "$SNAPSHOT_PATH/$LATEST_SNAPSHOT/snapshot" | \ pv --bytes | \ ssh "$REMOTE_HOST" "btrfs receive '$DEST_PATH'" && { - sudo echo "$LATEST_SNAPSHOT" > "$STATE_FILE" + sudo echo "$LATEST_SNAPSHOT" | sudo tee "$STATE_FILE" log "Incremental send completed successfully" } || { log "ERROR: Incremental send failed" diff --git a/nixos/hosts/nixos-framework/disks.nix b/nixos/hosts/nixos-framework/disks.nix index 273bd6ef..82210bfe 100644 --- a/nixos/hosts/nixos-framework/disks.nix +++ b/nixos/hosts/nixos-framework/disks.nix @@ -1,6 +1,15 @@ { imports = [ ../../common/services/snapper.nix ]; + + services.cron = { + systemCronJobs = [ + # Back up Local-Storage to NFS Storage + "0 9 * * * root rsync -avr /Local-Storage/Data/Docker/ifargle.com/vpn-stack/ /Storage/Data/Docker/ifargle.com/vpn-stack/" + "0 0 * * 3 albert sudo btrfs-backup root" + ]; + }; + services.btrfs.autoScrub.enable = true; services.btrfs.autoScrub.interval = "weekly"; diff --git a/wallpapers b/wallpapers index 26552d8b..8ed82c9a 160000 --- a/wallpapers +++ b/wallpapers @@ -1 +1 @@ -Subproject commit 26552d8bade6fa39188ebf68e9ffa1a8dcd75108 +Subproject commit 8ed82c9afaac6359cf4603196f7a5bd4b399a4b5