Update btrfs-backup script

This commit is contained in:
albert 2024-12-16 02:56:39 +01:00
parent 47ae1f2930
commit 44f06753fa
Signed by: albert
GPG key ID: 3895DD267CA11BA9
3 changed files with 12 additions and 3 deletions

View file

@ -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"

View file

@ -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";

@ -1 +1 @@
Subproject commit 26552d8bade6fa39188ebf68e9ffa1a8dcd75108
Subproject commit 8ed82c9afaac6359cf4603196f7a5bd4b399a4b5